What is the right query for joining 3 tables..
I want to make a view out of the 3 tables where Its populated by the data of 3 tables..
I want to display provCode from refprovince table ,citymunCode from refcitymun and brgyCode from refbarangay and also give them a distinct ID ..
CREATE VIEW ADRESSBOOK AS SELECT B.brgyCode AS BrgyCode, P.provCode AS ProvCode, C.citymunCode,
B.brgyCode
FROM [refprovince] P
JOIN refcitymun C ON P.provCode = C.provCode
JOIN refprovince P ON P.provCode = B.provCode
ORDER BY B.brgyCode

I want to make a view out of the 3 tables where Its populated by the data of 3 tables..
I want to display provCode from refprovince table ,citymunCode from refcitymun and brgyCode from refbarangay and also give them a distinct ID ..
CREATE VIEW ADRESSBOOK AS SELECT B.brgyCode AS BrgyCode, P.provCode AS ProvCode, C.citymunCode,
B.brgyCode
FROM [refprovince] P
JOIN refcitymun C ON P.provCode = C.provCode
JOIN refprovince P ON P.provCode = B.provCode
ORDER BY B.brgyCode
