访问查询排序问题 [英] Access Query Sorting Problem

查看:57
本文介绍了访问查询排序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在设计一个小型数据库的问题。我使用4个字段创建了一个简单的查询:


Sales_ID Pack_Number SOP_Number SOP_Line


显示时数据如下所示:

1 3 20462 1

2 2 20465 1

3 5 20470 2

4 7 20470 2

5 4 20470 5

如您所见,Sales_ID 3和4在SOP_Number和SOP_Line中包含相同的数据。我想显示数据但忽略SOP_Number和SOP_Line字段中的任何重复项,以便在上述记录中只显示4条记录1,2,3,5。


任意非常感谢帮助。

Hi Everybody
I have a problem with a small database which l am designing. I''ve created a simple query using 4 fields:

Sales_ID Pack_Number SOP_Number SOP_Line

When displayed the data looks like this:
1 3 20462 1
2 2 20465 1
3 5 20470 2
4 7 20470 2
5 4 20470 5

As you can see Sales_ID 3 and 4 contain the same data in the SOP_Number and SOP_Line. I would like to display the data but ignore any duplicates within the SOP_Number and SOP_Line fields so that in the above records only 4 records would be displayed 1,2,3,5.

Any help would be most appreciated.

推荐答案

假设您的表名是tblSales,所有字段,即:[Sales_ID],[Pack_Number],[SOP_Number]和[SOP_Line] ]是数字(LONG),[Sales_ID]是主键,此解决方案将起作用。请注意,SQL不是我的强项,更好,更短的解决方案可能会即将推出。
Assuming your Table Name is tblSales, all Fields, namely: [Sales_ID], [Pack_Number], [SOP_Number], and [SOP_Line] are Numeric (LONG), and [Sales_ID] is the Primary Key, this solution will work. Be advised that SQL is not my strong point, and a better, and shorter, solution will probably be forthcoming.
展开 | 选择 | Wrap | 行号


嗨ADezii

感谢您及时回复。由于这是我的第一个论坛问题,我真的很感动。我已经尝试过您的回复,但是我遇到了报告错误的问题:


此表达式中子查询的语法不正确。

检查子查询的语法并将子查询括在括号中。


在查询中没有经验,我试图追踪错误但没有运气。任何建议最受欢迎。

问候
Hi ADezii
Thanks for replying so promptly. As this is my first forum question l was really impressed. I''ve tried your reply but am having a problem with an error being reported:

The syntax of the subquery in this expression is incorrect.
Check the subquery''s syntax and enclose the subquery in parentheses.

Not being very experienced in queries l''ve tried to track down the error but not having any luck. Any suggestions most appreciated.
Regards



您好ADezii

感谢您的回复如此迅速。由于这是我的第一个论坛问题,我真的很感动。我已经尝试过您的回复,但是我遇到了报告错误的问题:


此表达式中子查询的语法不正确。

检查子查询的语法并将子查询括在括号中。


在查询中没有经验,我试图追踪错误但没有运气。任何建议最受赞赏。

问候
Hi ADezii
Thanks for replying so promptly. As this is my first forum question l was really impressed. I''ve tried your reply but am having a problem with an error being reported:

The syntax of the subquery in this expression is incorrect.
Check the subquery''s syntax and enclose the subquery in parentheses.

Not being very experienced in queries l''ve tried to track down the error but not having any luck. Any suggestions most appreciated.
Regards



一张图片胜过千言万语,所以我把测试数据库作为附件提供给你。当数据库打开时,将在数据库窗口中选择测试查询(qrySales)。

A picture is worth a thousand words, so I made the Test Database available to you as an Attachment. When the DB opens, the Test Query (qrySales) will be selected in the Database Window.


这篇关于访问查询排序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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