#1054 - 未知栏' vi.id'在' on条款'

时间:2015-03-04 14:29:25

标签: mysql

我收到错误“#1054 - 'on clause'中的未知列'vi.id'”以下查询任何一个帮助请

SELECT DISTINCT vtiger_salesorder.salesorder_no
FROM vtiger_salesorder
LEFT JOIN ( 
        select group_concat(TheSum)
        FROM (
            SELECT concat(productname, ', ',
                   SUM(vtiger_inventoryproductrel.quantity)) AS TheSum
            FROM vtiger_inventoryproductrel, vtiger_products
            where vtiger_products.productid = vtiger_inventoryproductrel.productid
            GROUP BY vtiger_products.productid
        ) T 
) As vi ON vi.id=vtiger_salesorder.salesorderid

1 个答案:

答案 0 :(得分:0)

如果您的ID在您子查询的这一部分中引用group_contat(TheSum)

select group_concat(TheSum)

添加别名id