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
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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.
 

ygilbert

New Member
Joined
Jul 12, 2008
Messages
44
Thanks I'll try this and get back to you. How do I switch from the SQL view back to the table view?
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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).
 

Watch MrExcel Video

Forum statistics

Threads
1,123,281
Messages
5,600,720
Members
414,401
Latest member
grenona2020

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