Left Join in Mysql? -
this first table.
then second 1 is
now trying left join this
select t1.stackid t1 left join t2 on t1.stackid=t2.stackid
output
i confused here, correct output? not supposed return 5 rows present in left side table.
it's correct output. doing left join
, every record in left table dbms 'concatenate' corresponding right table record(-s) (and null, if there's no corresponding record join
condition; remember, if there more 1 corresponding record - all joined - issue why you're getting not 5 records 1-st table).
the thing you're trying achieve should done either distinct
modifier, i.e.
select distinct t1.stackid t1 left join t2 on t1.stackid=t2.stackid;
more join in sql can read here.
Comments
Post a Comment