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 change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Watch MrExcel Video

Forum statistics

Threads
1,130,041
Messages
5,639,710
Members
417,106
Latest member
rbahena

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
Top