self join table

Posted by San82moon on Stack Overflow See other posts from Stack Overflow or by San82moon
Published on 2010-05-20T04:51:14Z Indexed on 2010/05/20 5:00 UTC
Read the original article Hit count: 177

Filed under:
|

HI,

i have a table,

    new_id----old_id----created_on
    1234------5678------20100912
    5678------3456------20100808

etc.

i wrote this query,

$q = "select event1.new_id, event1.old_id, event1.created_on,event2.new_id, event2.old_id, event2.created_on
  FROM replaced_isbns event1
  JOIN replaced_isbns event2 
  ON event2.new_id = event1.old_id
  WHERE event1.new_id='$id'";

but i get result as 5678 - 1234, ie only one row, i want all rows...

plz help me. Thanks, SLC

© Stack Overflow or respective owner

Related posts about php

Related posts about sql