我想得到一张桌子的数量,我也希望显示GeoID
的列表。问题是我无法在我的
SELECT
GeoTitle AS Expr1,GeoId , (GeoId+'%') as moh,
(SELECT
COUNT(Product.ProductId)
FROM
Company
INNER JOIN
Product ON Company.CompanyId = Product.CompanyId
WHERE
(Company.GeoId LIKE moh)
)
FROM
GeoLanguage
WHERE
(LanguageId = 1)
错误:
列名称'moh'无效。
答案 0 :(得分:1)
试试这个
SELECT A.GeoTitle AS Expr1,A.GeoId,
(SELECT count( Product.ProductId)
FROM Company INNER JOIN
Product ON Company.CompanyId = Product.CompanyId
WHERE (Company.GeoId LIKE A.GeoId+'%'))
FROM GeoLanguage as A
WHERE (A.LanguageId = 1)