SELECT * FROM
(
SELECT a.* , b.stock_idcode as x , c.stock_idcode_se as y
FROM `order` as a
LEFT JOIN `stock` as b ON (a.idcode = b.stock_idcode)
LEFT JOIN `stock_se` as c ON (a.idcode = c.stock_idcode_se)
)
WHERE x IS null AND y IS null
รันออกมาได้แบบนี้ครับ
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order.* , b.stock_idcode as x , c.stock_idcode_se as y FROM order as' at line 3
รบกวนด้วย ครับ
Tag : PHP, JavaScript, Action Script, Ajax, jQuery
SELECT tb.* FROM
(
SELECT a.* , b.stock_idcode as x , c.stock_idcode_se as y
FROM `order` as a
LEFT JOIN `stock` as b ON (a.idcode = b.stock_idcode)
LEFT JOIN `stock_se` as c ON (a.idcode = c.stock_idcode_se)
) As tb
WHERE tb.x IS null AND tb.y IS null
SELECT * FROM `order`
LEFT JOIN `stock` ON (order.idcode = stock.stock_idcode) AND (stock.stock_idcode IS null)
LEFT JOIN `stock_se` ON (order.idcode = stock_se.stock_idcode_se) AND (stock_se.stock_idcode_se IS null)
select `order`.idcode,`stock`.stock_idcode , `stock_se`.stock_idcode_se
from `order`
left join `stock` on `order`.idcode=`stock`.stock_idcode
left join `stock_se` on `order`.idcode=`stock_se`.stock_idcode_se
where `stock`.stock_idcode is null AND `stock_se`.stock_idcode_se is null
select idcode
from `order` as o
where not exists (select stock_idcode from `stock` where stock_id_code = o.idcode)
and not exists( select stock_idcode_se from `stock_se` where stock_idcode_se=o.idcode)