添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

SQLite3: SQLite不支持嵌套子查询吗? (环境:WIN7+ SQLite3 引擎版本: 3.7.16.1 )

SELECT CUST_NO, CUST_NAME, SUM(AMOUNT) As amount FROM (
select CUST_NO, CUST_NAME, SUM(AMOUNT) AS AMOUNT,order_date from  TB_ORDER
group by cust_no,cust_name,order_date
) AA
group by cust_no,cust_name,order_date

在提示窗口提示信息:

执行查询出错: no such column: .CUST_NO

解决方式: 表别名必须明确,并每个字段都要带上表别名, 例如:

SELECT AA.cust_no,AA.cust_name,AA.order_date, SUM(AA.AMOUNT) As amount FROM (
select CUST_NO, CUST_NAME, SUM(AMOUNT) AS AMOUNT,order_date from benluntongjiline
group by cust_no,cust_name,order_date
) AA
group by AA.cust_no,AA.cust_name,AA.order_date