Click here to Skip to main content
15,913,300 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying SELECT records from four different tables in mssql.
the quarry runs put no results is displayed. this is the quarry i used

SQL
SELECT P.Regdate, P.Assemblys, P.Surname, P.Othername, P.Gender, P.Nationality, P.Dateofbirth, P.Residentialaddress, P.Hometownaddress, P.Telephone, P.Email, P.Occupation, P.Maritalstatus, P.Nameofspouse, P.Mfullname, P.Mlivingstatus, P.Mhometown, P.Ffullname, P.Flivingstatus, P.Fhometown, P.NOKfullname, P.NOKresidence, P.NOKtelephone, C.Communicant, C.Holyspiritbaptism, C.Holyspiritbaptismdate, C.Holyspiritbaptismplace, C.Waterbaptism, C.Waterbaptismdate, C.Waterbaptismplace, C.Waterbaptismminister, C.Positionchurch, C.Cellgroups, M.Ministryname, O.Ministryname 
from tblPersonal P, tblChurchdetails C, tblMembershipministry M, tblMembershipotherministry O 
WHERE P.FormattedMembershipid= 'ATOM/000004' AND C.FormattedMembershipid= 'ATOM/000004' AND M.FormattedMembershipid= 'ATOM/000004' AND O.FormattedMembershipid= 'ATOM/000004'

please help me out
Posted
Updated 30-Apr-15 1:39am
v3

You need to join your tables together. I suggest referring to the documentation at https://dev.mysql.com/doc/refman/5.0/en/join.html[^]
 
Share this answer
 
Use inner join for four tables and put a where condition for your P.FormattedMembershipid= 'ATOM/000004'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900