Duplicate Items from a query

Chief

Registered User.
Local time
Today, 08:41
Joined
Feb 22, 2012
Messages
156
Access 2010
Hello,
I am trying to do a basic query where you are required to enter a colour or part thereof and have those items returned. In some cases I have asked 2 or three questions to be answered. But this example is just one.

The query is returning duplicates of the exact same items up to 6 or more times. how do I prevent these double ups? SQL below. I have a similar query on a different product which is working fine..

Thank you
Jason

SELECT tblSupplier.SuppName, tblEdging.EdgeColour, tblEdging.EdgeFinish, tblEdging.EdgeLength, tblEdging.EdgeWidth, tblEdging.EdgeThickness, tblEdging.EdgeRackLocation, tblEdging.EdgeDescription, tblEdging_1.JobAllocate, tblEdging_1.EstimateLength, tblEdging_1.ByWho, tblEdging.EdgeDataEntryDate, tblEdging.EdgeFormDate
FROM tblEdging AS tblEdging_1, tblSupplier AS tblSupplier_1, tblSupplier INNER JOIN tblEdging ON tblSupplier.SuppID = tblEdging.SuppID
WHERE (((tblEdging.EdgeColour) Like [What Colour or ENTER For All] & "*"));
 
You have not joined all your tables in the sql.
 
Is this the better way to do it?

SELECT tblSupplier.SuppName, tblEdging.EdgeColour, tblEdging.*
FROM tblSupplier INNER JOIN tblEdging ON tblSupplier.SuppID = tblEdging.SuppID
WHERE (((tblEdging.EdgeColour) Like [What Colour or ENTER For All] & "*"));

See also Attached screen shot please.
Thank you
Jason.
 

Attachments

  • qryEdgingByColor01.jpg
    qryEdgingByColor01.jpg
    91.8 KB · Views: 143
The best way the one that works. (fastest one if more then one way works)
Looks better now you just have two tables and they are joined.

An sql can have many tables but there should be a relationship between them so your select query can filter the data.

Sometimes you need to use Sub Queries.
 

Users who are viewing this thread

Back
Top Bottom