Query Duplicates

ygilbert

New Member
Joined
Jul 12, 2008
Messages
44
Hello there...

I have two tables within Access 2007. I would like to create a query that takes the ID from Table A and returns the sex in Table B. However Table B has multiple copies of the same ID. How can I retrieve only 1 record of data from Table B without having the query generate the multiple records in Table B as well.

Thanks

YG
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi

The SQL would look something like:

Code:
SELECT DISTINCT TableA.ID, TableB.Sex FROM TableA INNER JOIN TableB ON TableA.ID = TableB.ID

I have made assumptions about your TableB structure - that it has a linking field called ID that maps to TableA's ID field. You can click on the SQL view for the query you are creating and copy the above in.
 
Upvote 0
Thanks I'll try this and get back to you. How do I switch from the SQL view back to the table view?
 
Upvote 0
One of the toolbar/ribbon buttons is a dropdwon from which you can select the view you want (so you can switch easily between datasheet, design and SQL view).
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

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