-2

大家好,我有这个全局 mysql 查询

$table_res =  mysqli_query($GLOBALS["___mysqli_ston"], "SELECTtProduct.sProduct, tManufacturers.sManufacturer,
tSerie.sSerie, tApplication.sType, tApplication.sEngine, tApplication.sKiloWatt, tApplication.sHorsePower,
tApplication.sDate1, tApplication.sDate2 FROM tProduct INNER JOIN (tSerie INNER JOIN (tManufacturers INNER JOIN 
(tApplication INNER JOIN tApplicationProduct ON tApplication.nApplication = tApplicationProduct.nApplication) ON 
tManufacturers.nManufacturer = tApplication.nManufacturer) ON tSerie.nSerie = tApplication.nSerie) ON 
tProduct.nProduct = tApplicationProduct.nProduct WHERE sProduct = '$product'
ORDER BY tProduct.sProduct;");

如何从这个查询中获取行和字段,记住查询遗漏了Where参数。

4

1 回答 1

0

也许你正在追求这样的东西,虽然坦率地说我觉得这个命名政策很疯狂......

SELECT p.sProduct 
       , m.sManufacturer
       , s.sSerie
       , a.sType
       , a.sEngine
       , a.sKiloWatt
       , a.sHorsePower
       , a.sDate1
       , a.sDate2 
    FROM tProduct p
    JOIN tApplicationProduct ap
      ON ap.nProduct = p.nProduct 
    JOIN tApplication a
      ON a.nApplication = ap.nApplication
    JOIN tSerie s
      ON s.nSerie = a.nSerie
    JOIN tManufacturers m
      ON m.nManufacturer = a.nManufacturer
   WHERE p.sProduct = '$product' 
   ORDER 
      BY p.sProduct;
于 2013-09-13T21:08:18.917 回答