View Full Version : Query doesn't work please help


DavidND
11-28-2001, 12:15 PM
Peeps. This query I've tried to construct doesn't work. Can someone help me out please...

SELECT Org.Name AS Contractor, Jobs.CustName AS Customer, Jobs.Discription AS Job, Quotes.JobID, Quotes.WorkStatus AS Status, Quotes.EndDate AS Completed, Quotes.FinalCost AS Price
FROM (Org RIGHT JOIN Jobs ON Org.OrgID = Jobs.OrgID) INNER JOIN Quotes ON (Org.OrgID = Quotes.OrgID) AND (Jobs.JobID = Quotes.JobID)
WHERE (((Org.Name)="Distinct"))
ORDER BY Org.Name, Jobs.CustName;

Its suppsed to look in three tables, pull the Name of an Org and list all quotes by customer made by that org. The detail includes th work description, its status, end date and cost.

Many thanks

David

Pat Hartman
11-28-2001, 04:44 PM
Rearrange the tables in the QBE grid so that Jobs is on the left, Org is second, and Quotes is third. Then Left join Jobs to Org on OrgId and inner join Jobs to Quotes on OrgId and JobId. There should be no join line between Org and Quotes.