使用Access 2007保持在sql视图中输入的查询顺序结果视图

时间:2012-08-13 13:47:19

标签: sql ms-access-2007

如何在sql视图中保持查询顺序结果相同。我使用以下sql来获得结果

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"; 

但是当我希望订单保持在sql视图中输入时,结果总是以升序排列。

1 个答案:

答案 0 :(得分:1)

您尚未选择订单,您已创建了where语句。您可以使用具有自动编号的临时表作为您的条件,然后您可以使用自动编号作为您的订单。

SELECT TableName.NumBR
FROM TableName
INNER JOIN temp 
ON TableName.NumBR = Temp.NumBR
ORDER BY Temp.ID