Help left join
| From: | Wee Chua | Date: | Fri, 17 Nov 2000 13:50:36 +0000 |
| Subject: | Help left join | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25902@lists.php.net to get a copy of this message | ||
Hi everyone,
Could anyone look at my joins at let me know where is errors at, or how
should I do in order to get the result I want? The result i want must be
fullfill the condition of EventType.Type='Position' first then join with
Person table, how could run the small EventType condition loop first before
joining PersonEvent table with Person table. I tried to do Left join Person
(Left Join Event.......) but it gave me syntax errors. I really appreciate
if anyone could help, thank you!
Select
Project_ID,ProjectName,ProjCompanyType_ID,ProjCompanyType.Type,Company_ID,
Name,PositionType_ID,PositionType.Type,Person_ID,FName,Mid,LName,
Position_ID,PhoneType_ID,PhoneType.Type,Phone_ID,Area_Code,Phone1,Phone2,Ext
ension,
EmailAdd_ID,EmailAdd from Project
Left Join ProjCompany on Project_ID=FKProject_ID
Left Join ProjCompanyType on FKProjCompanyType_ID=ProjCompanyType_ID
Left Join Company on ProjCompany.FKCompany_ID=Company_ID
Left Join Position on Company_ID=Position.FKCompany_ID
Left Join PositionType on Position.FKPositionType_ID=PositionType_ID
Left Join PersonEvent on Position_ID=PersonEvent.FKPosition_ID
Left Join Event on PersonEvent.FKEvent_ID=Event_ID
Left Join EventType on FKEventType_ID=EventType_ID &&
EventType.Type='Position'
Left Join Person on PersonEvent.FKPerson_ID=Person_ID
Left Join EmailAdd on Person_ID=EmailAdd.FKPerson_ID &&
Position_ID=EmailAdd.FKPosition_ID && FKEmailAddType_ID='1'
Left Join Phone on Person_ID=Phone.FKPerson_ID
Left Join PhoneType on Phone.FKPhoneType_ID=PhoneType_ID
where Project_ID='$Project_ID'
Calvin