Displaying two or more tables from a search

Results 1 to 2 of 2

Thread: Displaying two or more tables from a search

  1. #1
    Join Date
    Dec 1969
    Posts
    322

    Default Displaying two or more tables from a search

    I have three seperate tables in my database. Each table contains related information about a member of my organisation <BR>e.g. <BR>Table 1 is personal info, <BR>table 2 is projects delivered and <BR>table 3 client relationships<BR>If I search table 1 by SURNAME how can I display only the related information from the other two tables. <BR>NOTE - table 2 and 3 have a StaffID number which is the primary key of table 1. <BR><BR>Can anyone help !!<BR>I tried joining the tables using SQL but had no luck. Save me from pulling my hair out.

  2. #2
    Join Date
    Dec 1969
    Posts
    1,019

    Default RE: Displaying two or more tables from a search

    sql="Select * FROM tbl1 A,tbl2 B, tbl3 C WHERE "<BR>&#039 set up the three tables as aliases A=tbl1, B=tbl2, C=tbl3<BR>sql=sql & "A.xx=" <BR>&#039 do your comparisons to search through table1<BR>sql=sql & " AND B.StaffID=A.StaffID AND C.StaffID=A.StaffID"<BR>&#039 this links the three tables to the StaffID number which carries to all three tables<BR>dbconn.execute(sql)<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •