July 8, 2010 at 12:32 pm
Hi all, i am trying to run a query with multiple joins which gives me the error saying C.OrganisationID could not be bound.
here is the query
SELECT O.Abbreviation, O.OrganisationName,
i.firstname, i.lastname, i.dob, i.gender, i.individualref, i.defaultemail, i.defaultphone,
i.defaultaddress,
PR.registrationtype, PR.RegistrationDate, PR.ValidFrom, PR.ValidTo, PR.Status, PR.RegistrationCategory,
PR.ProductID,
P.ProductID,
PCL.ClassificationID,
CL.Description
FROM FWBPlayerRegistration PR, FWBIndividual I, FWBContact C,
FWBProduct P, FWXProductClassification PCL, FWBClassification CL
INNER JOIN FWBOrganisation O ON C.OrganisationID = O.OrganisationID
Where PR.SeasonID = '457'
and C.RoleName = 'PLAYR'
and c.contactid = pr.contactid
and O.Abbreviation = 'CD0412'
and I.IndividualID = PR.IndividualID
and (PR.Status = 'PLYR_ACTI'
or PR.Status = 'PLYR_INACTI')
and PR.ProductID = P.ProductID
and P.ProductID = PCL.ProductID
and PCL.ClassificationID = CL.ClassificationID
I need to solve the issue asap, can anyone plz help asap...
much appreciated
thanks in advance
July 8, 2010 at 1:56 pm
a perfect example of why you should not use the old ansi syntax, and only the new ones with the JOIN keyword.
your query never connects the table FWXProductClassification to anything else in the query i think:
SELECT O.Abbreviation, O.OrganisationName,
i.firstname, i.lastname, i.dob, i.gender, i.individualref, i.defaultemail, i.defaultphone,
i.defaultaddress,
PR.registrationtype, PR.RegistrationDate, PR.ValidFrom, PR.ValidTo, PR.Status, PR.RegistrationCategory,
PR.ProductID,
P.ProductID,
PCL.ClassificationID,
CL.Description
FROM FWBPlayerRegistration PR
inner join FWBContact C on pr.contactid = c.contactid
INNER JOIN FWBOrganisation O ON C.OrganisationID = O.OrganisationID
inner join FWBIndividual I on PR.IndividualID = I.IndividualID
inner join FWBProduct P on PR.ProductID = P.ProductID
inner join FWXProductClassification PCL /*ON WHAT????*/
inner join FWBClassification CL on PCL.ClassificationID = CL.ClassificationID
Where PR.SeasonID = '457'
and C.RoleName = 'PLAYR'
and O.Abbreviation = 'CD0412'
and (PR.Status IN ( 'PLYR_ACTI','PLYR_INACTI') )
Lowell
July 8, 2010 at 2:21 pm
Lowell (7/8/2010)
a perfect example of why you should not use the old ansi syntax, and only the new ones with the JOIN keyword.your query never connects the table FWXProductClassification to anything else in the query i think:
SELECT O.Abbreviation, O.OrganisationName,
i.firstname, i.lastname, i.dob, i.gender, i.individualref, i.defaultemail, i.defaultphone,
i.defaultaddress,
PR.registrationtype, PR.RegistrationDate, PR.ValidFrom, PR.ValidTo, PR.Status, PR.RegistrationCategory,
PR.ProductID,
P.ProductID,
PCL.ClassificationID,
CL.Description
FROM FWBPlayerRegistration PR
inner join FWBContact C on pr.contactid = c.contactid
INNER JOIN FWBOrganisation O ON C.OrganisationID = O.OrganisationID
inner join FWBIndividual I on PR.IndividualID = I.IndividualID
inner join FWBProduct P on PR.ProductID = P.ProductID
inner join FWXProductClassification PCL /*ON WHAT????*/
inner join FWBClassification CL on PCL.ClassificationID = CL.ClassificationID
Where PR.SeasonID = '457'
and C.RoleName = 'PLAYR'
and O.Abbreviation = 'CD0412'
and (PR.Status IN ( 'PLYR_ACTI','PLYR_INACTI') )
Hello Lowell,
a column which is left null - "registrationtype", and i am trying to fetch all those along with certain more information.
Organisation and Contact are the tables which has OrganisationID in common, i m refering them both to each other to be able to fetch values from various tables.
i created this query uptil the following query
SELECT O.Abbreviation, O.OrganisationName,
I.Firstname, I.LastName, I.DOB, I.Gender, I.IndividualRef, I.DefaultEmail, I.DefaultPhone,
I.DefaultAddress,
PR.registrationtype, PR.RegistrationDate, PR.ValidFrom, PR.ValidTo, PR.Status, PR.RegistrationCategory,
PR.ProductID
FROM FWBPlayerRegistration PR, FWBIndividual I, FWBContact C
INNER JOIN FWBOrganisation O ON C.OrganisationID = O.OrganisationID
Where PR.SeasonID = '457'
and C.RoleName = 'PLAYR'
and C.ContactID = PR.ContactID
and O.Abbreviation = 'CD0412'
and I.IndividualID = PR.IndividualID
and (PR.Status = 'PLYR_ACTI'
or PR.Status = 'PLYR_INACTI')
it works fine, and after this when i add few more lines
P.ProductID, PCL.ClassificationID,
CL.Description
.
.
.
and PR.ProductID = P.ProductID
and P.ProductID = PCL.ProductID
and PCL.ClassificationID = CL.ClassificationID
is when it stops working and gives me error message. no i dont have any select or insert or other queries, i m running this syntax in sql server and then import data to excell or csv format, correct the errors by replacing with null and upload data back to server.
hope this much information will shed some more light to my question.
thx
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply