Thread: better approach: case or join

better approach: case or join

From
chester c young
Date:
from id extracting name from several tables.  which is generally the
better approach?

select case when tab_tla='usr' then (select name from users where ... )      case when tab_tla='con' then (select title
fromcontents where
 
...)
end    as name;

as versus

select  name
from    users
where   tab_tla='usr' and ...       join
select  title
from    contents
where   tab_tla='con' and ...

I assume the former since the optimizer does not examine whether the
entire where clause might be false before executing the query.

thanks,
chester


____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html