Reputation: 145
I have the following View:
I want to search there for, let's say: propertyname like 'Umax' and value_num = 550 but to display all properties from that part(s) (part_id) then. So in that case i would like to see all properties from parts 8, 10 and 11. And in addition I'd like to do that for more cases. Like: propertyname like 'Umax' and value_num = 550 and propertyname like 'Imax' and value_num = 5.5 which should show just all properties from part 8. Maybe I'm trying it in the completly wrong way, but I'm really struggling at this point right now!
Upvotes: 1
Views: 70
Reputation: 263713
You can use EXISTS()
.
SELECT a.*
FROM tableName a
WHERE EXISTS
(
SELECT 1
FROM tableName b
WHERE a.part_ID = b.part_ID AND
b.propertyname = 'umax' AND
b.value_num = 8
)
Upvotes: 1
Reputation: 35405
select * from table1 where part_id in
(select distinct part_id from table1 where propertyname = 'UMax' and <any other criteria>)
Replace table1
with your table/view name. You can add other criteria like value_num=5.5
and it should still work.
Upvotes: 0