sql - Order By Clause seems to be not working -
i have full-text search utilizes top , order by. i've used same query in database , order stays same. reason on different database, order seems change little. not lot, little. here looks like
select top 20 * ( select distinct candidateid, [resume], firstname, middlename, lastname, row_number() on (order createddate desc) num dbo.tblcandidates (contains(([resume]), @searchitem)) ) num > @start
can think of reason order clause wouldn't work in case?
thanks!
you don't have order by
clause (the 1 inside over()
clause used determine row_number()
, not have influence whatsoever of order of output). if you've observed specific order query on other systems, has been purely coincidental , should not relied upon. if want specific order, need add order by
outer query, no matter think should or have observed elsewhere.
select top 20 * ( select distinct candidateid, [resume], firstname, middlename, lastname, row_number() on (order createddate desc) num dbo.tblcandidates (contains(([resume]), @searchitem)) ) num > @start order num;
Comments
Post a Comment