比较同一表中多个列/行中的数据与查询

编程入门 行业动态 更新时间:2024-10-26 20:32:53
本文介绍了比较同一表中多个列/行中的数据与查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个包含2列的表,我需要数据库才能匹配。我有一群人列出了他们在一栏中的内容,在下一栏中列出了他们想要的内容。我需要数据库告诉我哪些匹配。 约翰尼有一个苹果但想要一个橙色 莎莉有一个橙子但想要一个苹果 Derek有一个梨,但想要一个香蕉。 在上面的场景中,数据库会告诉我比赛是Johnny和Sally,因为他们都有其他想要的。 Derek不会出现,因为他没有一个想要梨的人。可怜的Derek :-( 表名:FODEIDE18交换请求 栏目: ID ROM 排名 姓名 目前的学校选择 交换学校申请 优先顺序 DT功能区 我需要DB来比较当前的学校选择和交换学校请求 任何帮助你可以提供的将是惊人的!

I have a table that has 2 columns that I need the Database to match. I have a bunch of people that have listed what they have in one column and in the next column, they list what they want. I need the Database to tell me which ones match. Johnny has an apple but wants an orange Sally has an orange but wants an apple Derek has a pear, but wants a banana. In the above scenario, the Database would tell me that the matches are Johnny and Sally because they both have what each other wants. Derek would not show up since he didn''t have a person that wanted a pear. Poor Derek :-( Table name: FODEIDE18 Exchange Requests Columns: ID ROM Rank Name Current School Selection Exchange School Request Priority DT Functional Area I need the DB to compare Current School Selection and Exchange School Request Any assistance you can provide would be amazing!

推荐答案

为什么不命名这个列,并像这样引用它们我有一群人列出他们有什么在一栏和下一栏中,他们列出了他们想要的东西。? 当你有一张桌子时( ''Table1'')包含以下字段: Why not name this columns, and refer to them like this "I have a bunch of people that have listed what they have in one column and in the next column, they list what they want."? when you have a table (''Table1'') with these fields: 展开 | 选择 | Wrap | 行号

我不认为这就那么简单。 当菲尔还有一个橙子但想要一个苹果时会发生什么?所以Sally& Phil匹配Johnny。 另外,请尽量避免使用对象名称(表格,查询,表格和报告)以及字段名称中的空格。此外,ID作为字段名称不会告诉您该字段 - RequestID可能更好。此外,如果你想避免作家的抽筋,保持名称简短但有意义。 拥有有什么问题?和请求? Phil I don''t think it''s as simple as that. What happens when Phil also has an orange but wants an apple? So both Sally & Phil match Johnny. As an aside, try to avoid spaces in Object Names (Tables, Queries, Forms & Reports) and also in field names. Also ID as a field name tells you nothing about the field - RequestID might be better. Also, if you want avoid writers'' cramp, keep names short but meaningful. What is wrong with "Owned" and "Requested"? Phil

@PhilWalton:你是对的,这只是得到 j1s15n 开始了,现在让我们等待 j1s15n @PhilWalton: you are right, this was just a quick answer to get j1s15n started, now let''s wait for j1s15n

更多推荐

比较同一表中多个列/行中的数据与查询

本文发布于:2023-10-28 13:48:58,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   数据   一表中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!