Suppose i have a table "Employee". I insert Employee1 into Employee table. Then I insert Employee2 into Employee table. Now if i do "Select * from Employee", will i always get Employee1 followed by Employee2. In other words will the order be always Employee1 and then Employee2. Is there any change that i may get Employee2 and then Employee1?
Joined: Mar 22, 2005
The order in which you get results from a SQL database is not defined - it can change from request to request. If you want the same order every time you'll have to explicitly sort the results.
This will take the results and display them based upon the Employee column in descending order, basically showing it Employee2, Employee1. You can also play with the GROUP BY function to group results together, such as all employees in a particular work center. You can even use the ORDER BY with the GROUP BY to make the results return exactly like you want them to.
Bryan Scarbrough<br /> <br />Consistency is the last resort of the unimaginative!