In one machine, we have a set of data and say we have a column isValid which contains true or false and we also have another column which defines a group.For every group there can be only one value as tru开发者_如何学编程e for Isvalid column and the rest as false.
Now, when we run our query , based on Group, the row which contains the Isvalid column as True comes as the first row in query result and the rest of the rows contains the Isvalid column which are false.
Here we dont use any 'order by' or 'group by', we just use 'inner join' and 'where' conditions.
The issue is on our development server and test server we get the expected query results, but when it goes to live server(For all three servers, i.e development, testing and live server the data is entirely different and all these servers run on same version SQL 2005), the results are interchanged(Row with isvalid column false comes as first row in query result) don't know why.Any suggestions please?
Please help,
Many thanks, Byfour
The obvious answer is: different data on test, dev and live servers.
But even with the same data, without an ORDER BY
clause, results are usually returned in clustered index order, BUT this is not guaranteed.
If you require results in a specific ordering, then you must use an ORDER BY
clause.
精彩评论