mysql - Mulitple IN() operators - No results -


I have a query:

  select country country, country country Country is landed Country_networks on N. country.id = n.country_id and n.network_id IN (1,14)   

That works fine though, now I should be 'for this' The clause must be added so that the n.network_id is set (6,7,8,9). (BTW, they can have multiple network_ads, because I am pulling directly from a lookup table.)

So I tried to add another one:

  Select Country as Country Country, Country Contact Country Join country INNER country_networks country.ID = N. Country_ID and n.network_id IN (1,14) and n.network_id IN (6,7,8,9)   

which no longer yields any results.

It seems that I'm making a stupid mistake here. Can anyone see what this is? Thank you.

Yes; You must present that code in two non-intersections list.

To beat a dead horse, We look at every value

  price list 1 list 2 ------------------ 1 x 6 x 7 x 8 x 9 x 14 X   

This is a set of all values ​​that comes in the list; Anything outside the scope will not fit in either position, and none of the values ​​within the scope will fit in both situations.

To complete your status, there may be multiple network_id s based on the table of the Association in a country association of the country_network , You can do this:

  Connect the country country with different countryname, countryslug country_network cn1 at cn1.country_id = c.country_id include country_network cn2 cn2.country_id = c On the .country_id where in cn1.network_id (1, 14) and select in cn2.network_id (6, 7, 8, 9)    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -