4
I’m having a question of how to return records from a table have all the values reported in the operator IN
using JOIN
in another table.
I have a table of flags, colors and other making the relationship between the two (flags and colors);
flag table -> bandeira_id, nameBandeira
color table -> cor_id, CName
table flags -> id, flags, cor_id
Assuming the color 1 is Blue and the color 2 is White as I do to catch flags that have the colors Blue and White and not only White or only Blue.
I tried to use the operator IN
but brought the flags that have the color Blue or White.
SELECT nomeBandeira FROM bandeira INNER JOIN cor WHERE cor.cor_id IN (1,2)
Which DBMS are you using?
– bruno
I think it’s independent of DBMS...
– gmsantos
If it is using SQL Server I can resolve it using window functions. If you are using Mysql I cannot do this.
– bruno