c# - 如何使用 MS ACCESS QUERY 消除重复值

标签 c# database ms-access

SELECT [Household Info].[Household Head], [Household Info].Gender, [Household Info].[Household Members], Count(IIf([Household Members.Gender]="Male",0)) AS [Total Male], Count(IIf([Household Members.Gender]="Female",0)) AS [Total Female], Count(IIf([Household Members.Gender]="M","Male","Female")) AS [Total Gender], [Household Data].[Area of Homelot (ha)], [Household Data].[Area of Farmlot (ha)], [Household Data].[Area of Homelot (ha)]+[Area of Farmlot (ha)] AS [Total Area Occupied], [Household Data].[Date of Occupancy] 
FROM [Household Data], [Household Info] INNER JOIN 
[Household Members] ON [Household Info].HID = [Household Members].HID 
GROUP BY [Household Info].[Household Head], [Household Info].Gender, [Household Info].[Household Members], [Household Data].[Area of Homelot (ha)], [Household Data].[Area of Farmlot (ha)], [Household Data].[Area of Homelot (ha)]+[Area of Farmlot (ha)], [Household Data].[Date of Occupancy];

这是我在 MS ACCESS 中查询的输出

输出 enter image description here

我想消除这两个重复值,因为这应该只是 1 个 Grace Poe、1 个 PPeter Caapegsan 和 1 个 Rodrigo Duterte。

是的,应该只显示 3 个数据,但我不知道为什么会重复。

最佳答案

尝试使用主键。就像把它(例如)放在 reference_numb 列(ex 1 gracepoe 2 Ppeter Caapegsan 3 Rodrigo duterte)你的 reference_numb 是数字(基于我的前任)和主键。名称可能是您的列 full_Name,这样您就无法插入具有相同引用编号的数据

关于c# - 如何使用 MS ACCESS QUERY 消除重复值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37451291/

相关文章:

ms-access - 为开发人员记录 Access 应用程序

sql-server - 防止 Microsoft Access 锁定 MSSQL View Serverside?

c# - MS-Access 查询语法

c# - 为什么编译的委托(delegate)要比声明的委托(delegate)快?

c# - 为什么 CLR 的 jmp 指令无法验证?

c# - 在 Xamarin Forms 的某个页面中隐藏 TabBar

sql-server - SQL Server 中 View 的成本

c# - 尝试将值插入数据库并获取最后插入的 ID 时出错

sql - 在sql中执行排序操作后获取行的偏移量

node.js - 获取字段不是特定字符串的文档