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
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,216,624
Messages
6,131,788
Members
449,672
Latest member
Dervint81

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top