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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

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).
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,989
Messages
5,834,737
Members
430,315
Latest member
bobh63

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