Strange behavior of TOP 1 clause sql server
0
votes
2
answers
846
views
I have a SQL Server database and restored it on another server on a different machine. Now I run following same query on both DBs which produces same below result set.
But when I add TOP 1 clause to the above query, original DB shows the 2nd row (ignores first row)
while restored DB shows first row
I thought it might be due to different collation, but I checked both servers have same collation.
select person_id, visit_id, verification_code, mobileNo, created_date
from person
order by verification_code, created_date DESC

select TOP 1 person_id, visit_id, verification_code, mobileNo, created_date
from person
order by verification_code, created_date DESC


Asked by user1543848
(75 rep)
Apr 20, 2021, 09:03 AM
Last activity: Apr 20, 2021, 11:38 AM
Last activity: Apr 20, 2021, 11:38 AM