Last post Sep 09, 2019 12:17 AM by robby32
Sep 08, 2019 09:12 PM|robby32|LINK
Sep 08, 2019 11:42 PM|PaulTheSmith|LINK
SQL does not have the concept of a 'natural' order by design. Any database server is allowed to return rows in any order, different from one query to the next even. In SQL the result of a select (without the ORDER BY clause) is a SET which is inherently
unordered - that's part of the definition of a SET.
If you want to get rows in a particular order then you have to specify the order using the ORDER BY clause. There is no such thing as 'keep the order' because there is no order guaranteed.
One way would be to have a very small table (called, say, NamePriorities) with two columns. One column has each of the possible 'NAME' values and the other column is the Priority of that name. When you do your select query you would also join with the NamePriorities
table. Now the result can be sorted by the value of the Priority column.
Sep 09, 2019 12:17 AM|robby32|LINK
Thanks I will look at implementing the NamePriorities table.