寻找缺失的记录

发布于 2024-07-15 12:42:37 字数 394 浏览 7 评论 0原文

我对 MS Access 有点生疏,希望有人能帮助我......

我有一份由每个商店扫描(用于购买)的所有物品的列表,其中一个由 UPC 扫描月期间。 我还需要一组特定的 UPC 数据。 我想要得到的是那些没有被扫描的项目。 显然,未扫描的项目不会显示在已扫描项目列表中。

首先,我尝试进行交叉表查询...这很棒,但我只想查看“0”值。 理想情况下,我想将交叉表中的“0”值放入一个列出商店和 UPC 的简单表中。 我还尝试执行不匹配的查询,但这只返回 UPC...我需要知道它没有扫描到哪个商店...

我想我可能会有点错误。 就像我说的,我已经很多年没有使用 Access 了,如果我问一个超级简单的问题,我深表歉意。

有谁可以提供一些帮助吗?

先感谢您!

I'm a bit rusty when it comes to MS Access and I am hoping someone can help me out.....

I have a list of all items that have been scanned (for purchase) by each store, by UPC for a one month period. I also have a particular group of UPC's that I want data for. What I want to get is the items that DIDN'T get scanned. Obviously, the items that did not get a scan will not show up in list of scanned items.

First, I tried doing a crosstab query...which is great, but I only want to see the '0' values. Ideally I would like to put the '0' values from the crosstab into a simple table that lists the store and the UPC. I also tried doing an unmatched query, but that only returns the UPC....I need to know which store it didn't scan in....

I think I may be going about this a bit wrong. Like I said, I haven't used Access in years and I apologize if I am asking an uber easy question.

Anyone that can offer some assistance?

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

空袭的梦i 2024-07-22 12:42:38

我会使用:

SELECT ul.upc FROM upc_list ul 
LEFT JOIN upc_scanned us
ON ul.upc = us.upc
WHERE us.upc Is Null

与您的表和字段:

SELECT [Master UPC List].UPC 
FROM [Master UPC List] LEFT JOIN [No Scans] 
ON [Master UPC List].UPC = [No Scans].UPC 
WHERE [No Scans].UPC Is Null; 

I would use:

SELECT ul.upc FROM upc_list ul 
LEFT JOIN upc_scanned us
ON ul.upc = us.upc
WHERE us.upc Is Null

With your tables and fields:

SELECT [Master UPC List].UPC 
FROM [Master UPC List] LEFT JOIN [No Scans] 
ON [Master UPC List].UPC = [No Scans].UPC 
WHERE [No Scans].UPC Is Null; 
折戟 2024-07-22 12:42:38

我想你正在寻找这样的东西。 显然,您需要更改表名称和字段以匹配您的架构。

select UL.UPC from UPC_LIST UL where UL.UPC not in (
    select US.UPC from UPC_SCANNED US
)

I think you are looking for something like this. Obviously you will need to change table names and fields to match your schema.

select UL.UPC from UPC_LIST UL where UL.UPC not in (
    select US.UPC from UPC_SCANNED US
)
红尘作伴 2024-07-22 12:42:38

您能给我们介绍一下所涉及的表格吗?
如果您只有两张表,一张包含扫描的每个项目及其在哪个商店中扫描,一张列出所有项目,那么不匹配的查询返回的任何项目都不会在任何商店中扫描,这是您想要的吗? 您似乎要求它告诉您要在哪家商店进行扫描:)

Could you give us some idea of the tables involved?
If you only have two tables, one that contains each item scanned and which store it was scanned in, and one listing all the items, then any item returned by your unmatched query didn't scan in ANY store, is this what you want? You seem to be asking for it to tell you which store that it was meant to be scanned in :)

记忆で 2024-07-22 12:42:38

为了回答您的问题 pipTheGeek,我正在寻找哪些 UPC(如果有)未在哪些商店进行扫描。

例如,如果有 100 家商店,并且每家商店都应该有 Alpo 狗粮,我需要找出是否有任何商店在一个月内没有出售任何 Alpo 狗粮,以及那些商店号码是。 一旦我有了这些商店号码,我就可以进一步调查为什么它没有卖出去。

To answer your question pipTheGeek, I am looking for which UPC(s) (if any) were NOT scan in which stores.

For instance, if there are 100 stores, and Alpo Dog Food is supposed to be available in every store, I need to find out if there are any stores that did not sell any Alpo Dog Food during a one month period of time and what those store numbers are. Once I have those store numbers, I can investigate further as to why it did not sell.

梦回梦里 2024-07-22 12:42:38

Remou -

你给我的编辑过的 sql:

SELECT [Master UPC List].UPC
FROM [主 UPC 列表] LEFT JOIN [无扫描]
ON [主 UPC 列表].UPC = [无扫描].UPC
WHERE [无扫描].UPC 为空;

还返回0条记录......

Remou -

the edited sql you gave me:

SELECT [Master UPC List].UPC
FROM [Master UPC List] LEFT JOIN [No Scans]
ON [Master UPC List].UPC = [No Scans].UPC
WHERE [No Scans].UPC Is Null;

also returns 0 records.....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文