Using Crystal 11 & hoping I am in the right forum and this is coherent...(it's been awhile)
I am trying to create a comparison using a left outer join, which is not working. What I have forgotten is whether or not I can use any selection criteria on the outer joined table at all, even if I look for null values in the outer joined table key.
The first table is a list of possible parts we could have in types of machines. The second table is a list of individual machines with particular parts known to be in them. What I would like as my result set is a list of all the possible parts for a given type machine, whether or not they are installed in the given machine, along with matching parts information from the installed machine where the part number is found, like the following:
A.Part.Type A.PartNum A.PartName B.PartNum B.PartInstalledDate
VIDEOCARD VC111 Acme Vid Card
VIDEOCARD VC222 Bright Vid Card VC222 10/12/2012
VIDEOCARD VC333 XYZ Vid Card
I have printed out the parts list for a given machine type and for a particular machine and find in the Crystal report that I am getting some parts from both tables, but not all the rows I should be be getting from either side. I see no pattern in what’s not appearing.
I am creating the left outer join in the Select statement, something like this for a machine named NYC123:
SELECT Possible.PartNum, Possible.Part.Type, Possible.PartName , Installed.PartNum , Installed.Machine_Name, , Installed.PartInstalledDate
FROM dbo.Possible LEFT OUTER JOIN dbo.Installed ON Possible.Part_Number=Installed.Part_Number
WHERE Possible.Machine_Type=N'TypeA' AND (Installed.Machine_Name IS NULL OR Installed.Machine_Name=N'NYC123')
Thanks in advance for any thoughts and assistance,
Brad
I am trying to create a comparison using a left outer join, which is not working. What I have forgotten is whether or not I can use any selection criteria on the outer joined table at all, even if I look for null values in the outer joined table key.
The first table is a list of possible parts we could have in types of machines. The second table is a list of individual machines with particular parts known to be in them. What I would like as my result set is a list of all the possible parts for a given type machine, whether or not they are installed in the given machine, along with matching parts information from the installed machine where the part number is found, like the following:
A.Part.Type A.PartNum A.PartName B.PartNum B.PartInstalledDate
VIDEOCARD VC111 Acme Vid Card
VIDEOCARD VC222 Bright Vid Card VC222 10/12/2012
VIDEOCARD VC333 XYZ Vid Card
I have printed out the parts list for a given machine type and for a particular machine and find in the Crystal report that I am getting some parts from both tables, but not all the rows I should be be getting from either side. I see no pattern in what’s not appearing.
I am creating the left outer join in the Select statement, something like this for a machine named NYC123:
SELECT Possible.PartNum, Possible.Part.Type, Possible.PartName , Installed.PartNum , Installed.Machine_Name, , Installed.PartInstalledDate
FROM dbo.Possible LEFT OUTER JOIN dbo.Installed ON Possible.Part_Number=Installed.Part_Number
WHERE Possible.Machine_Type=N'TypeA' AND (Installed.Machine_Name IS NULL OR Installed.Machine_Name=N'NYC123')
Thanks in advance for any thoughts and assistance,
Brad