使用Access 2007保持在SQL视图中输入的查询顺序结果视图 [英] Keep query order results view as entered in the sql view using Access 2007

查看:102
本文介绍了使用Access 2007保持在SQL视图中输入的查询顺序结果视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何保持查询顺序结果与sql视图中的相同.我使用以下sql获取结果

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

但是当我希望保留在sql视图中输入的顺序时,结果总是按升序排序.

but the results are always resorted in ascending order when I would like the order to remain as entered in the sql view.

推荐答案

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

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

这篇关于使用Access 2007保持在SQL视图中输入的查询顺序结果视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆