1054 - Unknown column 'p.products_id' in 'on clause'
select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '4' and p2c.categories_id = '1'
[TEP STOP]
將該 SQL 整理後如下
select count(p.products_id) as total
from products_description pd
, products p
left join manufacturers m on p.manufacturers_id = m.manufacturers_id
, products_to_categories p2c
left join specials s on p.products_id = s.products_id
where p.products_status = '1'
and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id
and pd.language_id = '4'
and p2c.categories_id = '1'
複製代碼
有點奇怪的感覺。不過,此 SQL 在 MySQL 4.3 下是會正常執行,真的很隨性阿。作者: bestlong 時間: 2010-9-20 00:32