问题
How do I keep the query order results as in the sql view the same. I use the following sql to obtain the results
SELECT TableName.NumBR
FROM TableName
WHERE
NumBR = ""
OR NumBR Like "3101"
OR NumBR Like "3541"
OR NumBR Like "4381"
OR NumBR Like "AS3281"
OR NumBR Like "4260"
OR NumBR Like "4315"
OR NumBR Like "4330"
OR NumBR Like "4382"
OR NumBR Like "9410"
OR NumBR Like "9570"
OR NumBR Like "AS3710"
OR NumBR Like "AS4450"
OR NumBR Like "K400"
OR NumBR Like "3100"
OR NumBR Like "3130"
OR NumBR Like "3280"
OR NumBR Like "3495"
OR NumBR Like "3540"
OR NumBR Like "3610"
OR NumBR Like "3700"
OR NumBR Like "4110"
OR NumBR Like "4200";
but the results are always resorted in ascending order when I would like the order to remain as entered in the sql view.
回答1:
You have not selected an order, you have created a where statement. You can use a temporary table with an autonumber for your criteria, then you can use the autonumber for your order.
SELECT TableName.NumBR
FROM TableName
INNER JOIN temp
ON TableName.NumBR = Temp.NumBR
ORDER BY Temp.ID
来源:https://stackoverflow.com/questions/11935615/keep-query-order-results-view-as-entered-in-the-sql-view-using-access-2007