For an explicite sort order, there is this ORDER BY clause in SQL, all other orders are not guarrantied, but the result of the query process. When SQL Server decides to reorganize it's internal page allocations, the result may be in another order.
Make everything as simple as possible, but not simpler! - A. Einstein
DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool
arprince, when you run a query without an ORDER BY, you are getting the results unsorted
just because you get a different apparent order depending on the presence of the employee column does not mean that it is sorted by employeeid
if it seems that way, it's just a coincidence
in fact, it is most likely due to the way the optimizer executes the query
with the employee field included, the left outer join must now actually look at employee rows, and it is probably using a clustered index, which of course could easily change the sequence of result rows
i'm not a DBA, so performance and optimizer nuances like that don't really matter to me
what is very clear is this: any result set order you get without an ORDER BY is not guaranteed to be in any particular order at all, despite the fact that it seems to be
if you want them in a particular order, such as work order number, then you have to ask for it that way
it is either PK or clustered index that is present on employeeid. you can try to include (index=0) after employee as e, but that will not guarantee that the index/PK will not be selected by the optimizer when returning recordset to the client.