Reputation: 7990
I have a search page in which I am searching data by passing multiple parameters. I am using StartDate (Datetime field) as default sort order (result are sorted on the basis of StartDate if no sort order is provided). While searching I am getting random row order of data when multiple rows have same StartDate. Can anybody tell me what is the reason for this? Thanks
Upvotes: 0
Views: 213
Reputation: 65157
If you don't explicitly define a sort order, there is no guaranteed order for the rows to be returned in.
If you ORDER BY
a single field, the order of rows within groups that have a match on that field is indeterminate unless you define it.
I'm not sure what you expect to get back order-wise. If you have an order you would like, you must specify it to get those rows in that order.
Period.
Upvotes: 4