SQL Inner Join Examples


Sql two or more tables INNER JOIN  condition


<?php
            $sql="select
            c.campaignnm,
            c.userid,
            c.campaignid,
            eq.esendid,
            eqd.esendid,
            eqd.groupid
            from emailcampaign c
            inner join emailqueue eq on eq.campaignid = c.campaignid
            inner join emailqueuedtl eqd on eqd.esendid = eq.esendid";
?>


Sql two or more tables OUTER JOIN condition

<?php

    $sql5="Select
                s.segmentnm,
                sc.conditionval,
                sc.andor,
                fp.fieldcaption,
                cn.conditionnm,
                gp.groupnm
                from segments s
                left outer join segmentcondition sc on sc.segmentid = s.segmentid
                left outer join fieldmapping fp on fp.fieldmappid=sc.fieldmappid
                left outer join conditionmst cn on cn.conditionid = sc.conditionid
                left outer join segmentgroups sg on sg.segmentid = s.segmentid
                left outer join groupmst gp on gp.groupid = sg.groupid";

?>
Share on Google Plus

About quora Questions & Answers A-Z

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment