0
我想做一個命令查詢,但我不知道爲什麼它不工作這是我的查詢我不知道在哪裏把訂單,我測試與每一個選擇,不工作,經過測試把它放在最後一個查詢沒有變化,你能幫我嗎? 我想a.idSQL查詢與UNION命令的問題
$data = null;
$sth = Model::connect()->prepare(" SELECT a.*, b.ciudad, d.catgoria, d.categorie, e.mark AS marka , c.fuel FROM table1 a,
fuel c ,ciudad b, table2 d , coches e WHERE
a.ciudad = b.id_vil AND a.mark = e.id AND a.fuel = c.id AND d.id = a.table3 AND a.status = 1
UNION
SELECT a.*, b.ciudad, d.catgoria, d.categorie, e.mark AS marka , c.fuel FROM table1 a,
fuel c ,ciudad b, table2 d , liste_vehicules_marchandises e WHERE
a.ciudad = b.id_vil AND a.mark = e.id AND a.fuel = c.id AND d.id = a.table3 AND a.status = 1
UNION
SELECT a.*, b.ciudad, d.catgoria, d.categorie, e.mark AS marka , c.fuel FROM table1 a,
fuel c ,ciudad b, table2 d , liste_vehicules_agricultures e WHERE
a.ciudad = b.id_vil AND a.mark = e.id AND a.fuel = c.id AND d.id = a.table3 AND a.status = 1
UNION
SELECT a.*, b.ciudad, d.catgoria, d.categorie, e.mark AS marka , c.fuel FROM table1 a,
fuel c ,ciudad b, table2 d , bc_vehicule e WHERE
a.ciudad = b.id_vil AND a.mark = e.id AND a.fuel = c.id AND d.id = a.table3 AND a.status = 1
");
$sth->execute();
$data = $sth->fetchAll();
return $data;
什麼不工作,什麼是需要的行爲和實際發生的事情。樣本數據? –