Hey All... I am little shaky on joins....

Question one... I am getting a can't executre reponse from this... Can anyone clarify or corret the syntax/logic?

<?php
$sql = " SELECT *  FROM table1 , table2, table3
LEFT JOIN vxuid ON table1.vxuid=table3.vxuid
LEFT JOIN ctst ON table1.ctst=table2.ctst
WHERE ($id=table1.pid)";
?>

Question TWO is is better to NOT have duplicate data (other than key fields) in multiple tables and focus more on bring what I want in with joins?

    $sql = " SELECT *  FROM table1 
    left JOIN table3 
    ON table1.vxuid=table3.vxuid
    
    left JOIN table2 ON table1.ctst=table2.ctst
    
    WHERE ($id=table1.pid)";
    

    Do you really need an outer join?

    2) Yes.

      Originally posted by Lars Berg

      $sql = " SELECT *  FROM table1 
      left JOIN table3 
      ON table1.vxuid=table3.vxuid
      
      left JOIN table2 ON table1.ctst=table2.ctst
      
      WHERE ($id=table1.pid)";
      

      Do you really need an outer join?

      2) Yes. [/B]

      Thanks I will try and work with this... Something tells me my syntax is inches away....

      1. an outer join is essentially joining fields NOT from the root table, but common (from the main join) to secondary tables? yes?
        Write a Reply...