It is a hack, but when someone wants you to do something in a way
different from the norm, aren't they asking for a hack?
SQL Server does something like
select top (1) from ....
I am thinking this is NOT a SQL-99 standard.
This was an interview with Amazon, and I don't think Amazon wanted a hack.
I hope Amazon doesn't use hacks. There has to be another way. It would
be cruel if they expected me know some database specific functionality.
Here's what I gave them:
select value
from table t
where t.value >
(select t2.value
from table t2);
which would be fine if the sub-select returned simply a list, but that
isn't even valid SQL (I didn't get the job, BTW).
Yasir
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match