MS Access 2003 - 列表框的字符串值不按字母顺序排序
这是一个愚蠢的问题。假设我有一个生成列表框的查询,它会生成三个商店的值
Store A 18
Store B 32
Store C 54
现在,如果我在 sql 语句中 ORDER BY,它唯一要做的就是按字母顺序降序或升序,但我想要一定的顺序(只是因为它们)想要一个特定的订单).....所以有没有办法让我在 SQL 中添加一些东西来得到,即
Store B
Store C
Store A
基本上逐行得到我想要的。谢谢!
Here is a silly question. Lets say I have a query that produces for a list box, and it produces values for three stores
Store A 18
Store B 32
Store C 54
Now if I ORDER BY in the sql statement the only thing it will do is descending or ascending alphabetically but I want a certain order (only because THEY WANT A CERTAIN ORDER) .....so is there a way for me to add something to the SQL to get
Store B
Store C
Store A
i.e. basically row by row what i want. thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将数字字段sequencer添加到包含商店名称的表中。使用sequencer值来确定排序顺序。
在列表框中,将sequencer列的列宽设置为0。
或者简单地,如 @dscarr 建议,不要在
SELECT
字段列表中包含sequencer,而只需将其包含在ORDER BY ...
Add a numeric field, sequencer, to the table which contains the store names. Use the sequencer values to determine your sort order.
In the list box, set the column width = 0 for the sequencer column.
Or simply, as @dscarr suggested, don't include sequencer in the
SELECT
field list, but just include it in theORDER BY
...您可以做两件事中的一件。
使用 SWITCH 语句,例如
或使用辅助订单表,它存储商店名称的值以及按值排序。
You can do 1 of 2 things.
Either use a SWITCH stament, something like
Or use a secondary order table, that stores the values of the store names, and an order by value.