Remove duplicates from Query

J

jason

I have duplicates returned in the following query. Is it possible to refine
this query to remove the duplicates or prevent duplicates from occuring
without disrupting the query?

PARAMETERS ListingsID Long;

SELECT tblListings.ListingsID, tblListings.Insertion_Date, tblListings.Code,
tblListings.Condition, tblListings.Status, tblCompany.Company,
tblListings.Name, tblListings.Name_Client, tblModel.Model,
tblListings.Size_ID, tblListings.Hull_Number, tblListings.Year,
tblYacht_Type.Yacht_Type, tblListings.Original_Price,
tblListings.Current_Price, tblListings.Status_Price_Reduced,
tblListings.Price_Reduction_Date, tblLocation_Status.Location_Status,
tblListings.Marina, tblState.State, tblCountry.Country,
tblListings.Listing_Broker_ID, tblListings.Date_viewable,
tblListings.Comments, tblListings.Link, tblListings.Closing_Date,
tblSource.Source, tblListings.Image1, tblListings.Image2,
tblListings.Image3, tblListings.Status_Charter

FROM (tblCompany
INNER JOIN (tblSource
INNER JOIN (tblYacht_Type I
NNER JOIN (tblCountry
INNER JOIN (tblState
INNER JOIN (tblLocation_Status
INNER JOIN (tblModel
INNER JOIN tblListings

ON tblModel.ModelID = tblListings.Model_ID)
ON tblLocation_Status.Location_StatusID = tblListings.Location_Status_ID)
ON tblState.StateID = tblListings.State_ID) ON tblCountry.CountryID =
tblListings.Country_ID)
ON tblYacht_Type.YachtTypeID = tblListings.Yacht_Type_ID)
ON tblSource.SourceID = tblListings.Source_ID) ON (tblCompany.CompanyID =
tblListings.Company_ID)
AND (tblCompany.CompanyID = tblListings.Company_ID))
LEFT JOIN tblPriceReduction
ON tblListings.ListingsID = tblPriceReduction.Listings_ID

WHERE (([ListingsID] Is Null Or [tblListings].[ListingsID]=[ListingsID]));
 
A

Ashby

Have you taken a look at the "DISTINCT predicate" - (see
Access help for more information)
-----Original Message-----
I have duplicates returned in the following query. Is it possible to refine
this query to remove the duplicates or prevent duplicates from occuring
without disrupting the query?

PARAMETERS ListingsID Long;

SELECT tblListings.ListingsID,
tblListings.Insertion_Date, tblListings.Code,
tblListings.Condition, tblListings.Status, tblCompany.Company,
tblListings.Name, tblListings.Name_Client, tblModel.Model,
tblListings.Size_ID, tblListings.Hull_Number, tblListings.Year,
tblYacht_Type.Yacht_Type, tblListings.Original_Price,
tblListings.Current_Price, tblListings.Status_Price_Reduced,
tblListings.Price_Reduction_Date,
tblLocation_Status.Location_Status,
tblListings.Marina, tblState.State, tblCountry.Country,
tblListings.Listing_Broker_ID, tblListings.Date_viewable,
tblListings.Comments, tblListings.Link, tblListings.Closing_Date,
tblSource.Source, tblListings.Image1, tblListings.Image2,
tblListings.Image3, tblListings.Status_Charter

FROM (tblCompany
INNER JOIN (tblSource
INNER JOIN (tblYacht_Type I
NNER JOIN (tblCountry
INNER JOIN (tblState
INNER JOIN (tblLocation_Status
INNER JOIN (tblModel
INNER JOIN tblListings

ON tblModel.ModelID = tblListings.Model_ID)
ON tblLocation_Status.Location_StatusID = tblListings.Location_Status_ID)
ON tblState.StateID = tblListings.State_ID) ON tblCountry.CountryID =
tblListings.Country_ID)
ON tblYacht_Type.YachtTypeID = tblListings.Yacht_Type_ID)
ON tblSource.SourceID = tblListings.Source_ID) ON (tblCompany.CompanyID =
tblListings.Company_ID)
AND (tblCompany.CompanyID = tblListings.Company_ID))
LEFT JOIN tblPriceReduction
ON tblListings.ListingsID = tblPriceReduction.Listings_ID

WHERE (([ListingsID] Is Null Or [tblListings].[ListingsID] =[ListingsID]));


.
 

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