Well, I'm stumped on this one, the solution is probably staring me in the face, but I figgured I'd pop in here to ask quick-like.
Here's the table I'm working with:
Table Name: pprops
pp_id pl_id re_id
----- ----- -----
1 45 19
2 45 22
3 34 19
4 35 29
I'm using this as a pivot table, and would like to be able to pull out pl_id based on multiple constraints of re_id. For instance, using the sample data above, I would like have a SELECT query with the constraints of: re_id = 19 AND re_id = 22
With the result being: pl_id = 45
I thought I could do this using:
SELECT DISTINCT pl_id FROM pprops WHERE re_id = 19 AND re_id = 22;
Unfortunately, because re_id can only have 1 value in it I always get 0 results.
Will I have to use some form of subquery or self-join to get this to work?
Any and all help and or pointing in the right direction is greatly appreciated!
Here's the table I'm working with:
Table Name: pprops
pp_id pl_id re_id
----- ----- -----
1 45 19
2 45 22
3 34 19
4 35 29
I'm using this as a pivot table, and would like to be able to pull out pl_id based on multiple constraints of re_id. For instance, using the sample data above, I would like have a SELECT query with the constraints of: re_id = 19 AND re_id = 22
With the result being: pl_id = 45
I thought I could do this using:
SELECT DISTINCT pl_id FROM pprops WHERE re_id = 19 AND re_id = 22;
Unfortunately, because re_id can only have 1 value in it I always get 0 results.
Will I have to use some form of subquery or self-join to get this to work?
Any and all help and or pointing in the right direction is greatly appreciated!