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
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Watch MrExcel Video

Forum statistics

Threads
1,099,482
Messages
5,468,870
Members
406,618
Latest member
SAMEERS

This Week's Hot Topics

Top