执行mysql查询时出错

时间:2014-06-11 11:52:27

标签: mysql

SELECT COUNT(packages.id) AS rowCount,
       packages.packageCode
FROM packages
INNER JOIN prices ON packages.packageCode = prices.packageCode
WHERE TRUE packageCode LIKE '%EPOP%'
ORDER BY packageName ASC

where子句有错误,任何人都可以帮忙...

1 个答案:

答案 0 :(得分:1)

只需更改where packages.packageCode而不是packageCode的子句,因为两个表中的packageCode都会出现歧义错误,并从where子句中删除TRUE个字。

SELECT COUNT(packages.id) AS rowCount,
       packages.packageCode
FROM packages
INNER JOIN prices ON packages.packageCode = prices.packageCode
WHERE packages.packageCode LIKE '%EPOP%'
ORDER BY packages.packageName ASC