Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: IN statment

$
0
0

Sergey_S wrote:

 

I have the table:

   

IDcondition_id
property_id
1c_3b_1
2c_13b_2
3c_3b_4
4c_13b_1
5c_3b_2
6c_4b_1

 

I need to select all properties with condition_id c_3 and c_13 not just c_3 or c_13 (I expect in the result it should be only b_1 and b_2)

 

The query like this:

 

SELECT *

FROM table

WHERE condition_id IN (  3,13                                                            )

A simple way to do it is:

 

SELECT *

FROM table

WHERE condition_id IN ('c_3') AND property_id IN (SELECT property_id FROM table WHERE condition_id IN ('c_13'))


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>