i have two tables both with firstname lastname colums

i can make them print out like

fistname1 lastname1 firstname2 lastname2
fistname1 lastname1 firstname2 lastname2

but what i want is

firstname? lastname?
firstname? lastname?
firstname? lastname?
firstname? lastname?

ordered by lastname

i suspect it has somthing todo with left join but most examples arent that straight forward

this is the one i dont really need
[:code:]

SELECT table1.firstname as fn1, table1.lastname as ln1, table2.firstname as fn2, table2.lastname as ln2 FROM table1, table2 WHERE table1.id = table2.id

[:/code:]

thanks in advance

    // Assuming that $result holds the result of your query
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
       print $row['fn1'] . " " . $row['ln1'] . "<br>\n";
       print $row['fn2'] . " " . $row['ln2'] . "<br>\n";
    }
    

    You can remove the <br> if you aren't sending this data to a web browser.

      Write a Reply...