H
hikaru
i have the following query:
SELECT Projects.FNumber, Projects.Category, Projects.Category2,
Projects.WorkType, [ProjName]+" "+[Description] AS [Project Name],
Projects.City, Projects.Suburb, Projects.Area, Projects.PlotNo,
Projects.ContNo, Company.AraName AS [Consultant 1], Company_1.AraName AS
[Consultant 2]
FROM Company AS Company_1 INNER JOIN (Company INNER JOIN Projects ON
Company.CompanyID = Projects.ConsultantID) ON Company_1.CompanyID =
Projects.ConsultantID2
WHERE (((Company.AraName)=(select Company.AraName from Company where
Company.CompanyID = Projects.ConsultantID)) AND ((Company_1.AraName)=(select
Company.AraName from Company where Company.CompanyID =
Projects.ConsultantID2)));
the query is based on two tables: Projects and Company/Company_1
I have two forein keys in Projects which are ConsultantID and ConsultantId2.
ConsultantId2 can be null, that is why I get the problem with the query. So,
the query will only list the Projects that have both ConsultantID and
ConsultantId2 filled with a number.
any solution to list all Projects even if they don't have a second Consultant?
thanks in advance.
SELECT Projects.FNumber, Projects.Category, Projects.Category2,
Projects.WorkType, [ProjName]+" "+[Description] AS [Project Name],
Projects.City, Projects.Suburb, Projects.Area, Projects.PlotNo,
Projects.ContNo, Company.AraName AS [Consultant 1], Company_1.AraName AS
[Consultant 2]
FROM Company AS Company_1 INNER JOIN (Company INNER JOIN Projects ON
Company.CompanyID = Projects.ConsultantID) ON Company_1.CompanyID =
Projects.ConsultantID2
WHERE (((Company.AraName)=(select Company.AraName from Company where
Company.CompanyID = Projects.ConsultantID)) AND ((Company_1.AraName)=(select
Company.AraName from Company where Company.CompanyID =
Projects.ConsultantID2)));
the query is based on two tables: Projects and Company/Company_1
I have two forein keys in Projects which are ConsultantID and ConsultantId2.
ConsultantId2 can be null, that is why I get the problem with the query. So,
the query will only list the Projects that have both ConsultantID and
ConsultantId2 filled with a number.
any solution to list all Projects even if they don't have a second Consultant?
thanks in advance.