[thelist] SQL replace subquery with join

r937 rudy at r937.com
Tue Jan 5 13:16:38 CST 2010


> I'd probably still write the subquery version, as I think it looks more
elegant and it more obviously says what it does. At least to me :-)

i understand where you're coming from    ;o)

now let's consider execution efficiency

any solution that returns all possible rows, only to throw many of them away 
(e.g. david's MAX and HAVING trick) will be less efficient than a solution 
that attempts to retrieve only one particular genre

and the NOT EXISTS solution is notoriously inefficient

only high-volume benchmarks can effectively resolve a scenario where a given 
problem has multiple, often wildly different solutions

;o) 




More information about the thelist mailing list