Display records from query where data is duplicated in 2 fields

scopar

New Member
Joined
May 13, 2014
Messages
12
Hi,

I'm using Excel 2013 (Win 7) and am using MS Query to get data from our SQL Server - just using a single table. I want to display only the records where a value in one column is the same as that in the next column.

The data displayed is:

AccountNo
DebtorID
ParentDebtorID

The query is set up as:

SELECT DB_Main.AccountNo, DB_Main.DebtorID, DB_Main.ParentDebtorID
FROM DB1.DB_Main DB_Main
Where DB_Main.DebtorID = DB_Main.ParentDebtorID

For some reason, the results still include records where the DebtorID is not equal to the ParentDebtorID.

I have a work around in place which is to display all the records and then use a formula to indicate where the fields aren't the same so I can just sort and ignore those records, but it seems like it should be such an easy thing to do in the query. I'm sure I'm missing something obvious.

Can anyone see what I might be doing wrong? Let me know if more info is needed.

Thanks,
Scott
 

Forum statistics

Threads
1,086,243
Messages
5,388,668
Members
402,134
Latest member
McKnze21

Some videos you may like

This Week's Hot Topics

Top