sql server 2008 - SQL top 1 within WITH statement -
i have sql query makes use of statement. query looks this:
with topage ( select top 1 * ages order age ) select * topage agegroup = 1 my question whether where clause gets executed after top statement, because query retrieves no records whereas know there records in database should retrieved.
thanks in advance help.
the answer is: yes, agegroup = 1 predicate applied after selecting top 1. query equivalent this
select * ( select top 1 * ages order age ) agegroup = 1 what maybe want this
select top 1 * ages agegroup = 1 order age
Comments
Post a Comment