加入postgresql

时间:2013-07-18 09:30:01

标签: postgresql

如何将此Oracle sql更改为postgresql

SELECT prd.name, pkg.name, si.name 
FROM service_items si, service_link sl, products prd, packages pkg, product_package_link ppl 
WHERE ppl.id='3' 
AND prd.id=ppl.product_id
AND pkg.id=ppl.package_id AND sl.product_package_id(+)=ppl.id AND si.id(+)=sl.service_item_id
 ;

1 个答案:

答案 0 :(得分:1)

尝试

SELECT prd.name, pkg.name, si.name 
  FROM products prd JOIN product_package_link ppl
    ON prd.id = ppl.product_id JOIN packages pkg
    ON pkg.id = ppl.package_id LEFT JOIN service_link sl
    ON ppl.id = sl.product_package_id LEFT JOIN service_items si
    ON si.id  = sl.service_item_id
 WHERE ppl.id = '3'