Saturday, August 2, 2008

JOIN SQL

//INNER JOIN
SELECT a.nostaf, a.nama , b.department
FROM asas a INNER JOIN khidmat b
ON a.nostaf = b.nostaf
AND a.nostaf = :stafno;

//OR
SELECT a.nostaf, a.nama , b.department
FROM asas, khidmat b
WHERE a.nostaf = b.nostaf
AND a.nostaf = :stafno;


//NATURAL JOIN
SELECT a.nostaf, a.nama , b.department
FROM asas a NATURAL JOIN khidmat b
WHERE a.nostaf = b.nostaf

No comments: