I have a query like this and using infobright database --
select field1, field2
from foo
where filed1 in (1,2,3)
I want something to return even if there is no record in table. For example, there is record for filed1 = 2 and filed1 = 2 but nothing exists for filed1 = 3.
How could I make this query so I get something returning from the table for field1 = 3 ? I could use ifnull in case there is a null value in the table for field1 = 3, but what I am trying find if there is absolutely nothing exists.
If field1 is unique you can do this:
Otherwise you can use UNION like this: