List only 1 Rec No when more than 1 match

K

Kahuna

Hi Folks, I have two tables:

tblFilter (one)
fldID

tblDWG (many)
fldDWGNo
fldID

They link on fldID and tblDWG may have many records matching one tblFilter.

I need to list the records in tblDWG which match those in tblFilter, but
list those records only once regardless of how many there are! The 1st
record takes precedence.

Any guidance would be appreciated.

Cheers
 
H

Heather

Try:

Select fldID, first(fldDWGNo) from tblDWG, tblFilter
where
tblFilter.fldID = tblDWG.fldDWGNo
 
J

John Vinson

Hi Folks, I have two tables:

tblFilter (one)
fldID

tblDWG (many)
fldDWGNo
fldID

They link on fldID and tblDWG may have many records matching one tblFilter.

I need to list the records in tblDWG which match those in tblFilter, but
list those records only once regardless of how many there are! The 1st
record takes precedence.

Make it a Totals query by clicking the Greek Sigma icon; group by
fldID and select First of fldDWGNo. This will show the first record IN
DISK STORAGE ORDER - bear in mind that this order is *completely
arbitrary*, it won't necessarily be the first record entered. Use Min
instead of First if you want the lowest numeric value of fldDWGNo.
 
K

Kahuna

Thanks for the feedback John, but this result appears to exclude any records
where the fldDWG may be null (this can be the case) though that record
should still be listed bt fldID (in tblFilter)

Any suggestions to show those records?
 
J

John Vinson

Thanks for the feedback John, but this result appears to exclude any records
where the fldDWG may be null (this can be the case) though that record
should still be listed bt fldID (in tblFilter)

Any suggestions to show those records?

Change the join type to Left Outer Join - select the line joining the
two tables in query design view and choose Option 2 (or 3), "show all
records in <first table> and matching records in <the second table>".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top