Re: Query with IF acting wierd.

2004-03-11 Thread Amir Hardon
Thanks, but this is just a nicer way to apply my second solution, I'm looking for a more efficient solution (and if someone can than for an explanation - why are the results getting duplicated?) -Amir. On Thursday 11 March 2004 15:40, Hans van Dalen wrote: > SELECT distinct main.id, etc.

Query with IF acting wierd.

2004-03-11 Thread Amir Hardon
I have 3 tables: main(id int, type tinyint(1)) categories(id int, name varchar) items(id int, name varchar) I want to select the id and name. If type is 1 then I want to select the name from categories, if type is 0 I want to select the name from items, here is the query I'm trying to use: SELE