On one of my interviews I was asked how it's possible to select
maximal value from DB without keyword MAX and TOP.
My answer was:
select Table.Value
from Table
where Table.Value >= all( select Table.Value from Table)
But this wasn't the right one. The interviewer said that I should do it only with one select.
Any ideas ?
Thank you ;)
row_number?MAXandTOPwould both be more efficient. Also what do you mean by "oneSELECT". With a CTE theSELECTkeyword appears twice. Once for the definition and once toSELECTfrom it but it isn't really 2SELECToperations.