1248 - Every derived table must have its own alias (MYSQL错误)
这句话的意思是说每个派生出来的表都必须有一个自己的别名
我的Mysql语句是:select count(*) from (select * from dede_spacemoney group by sid) ;
当我执行到这里的时候就抛出了这个异常,原来我进行嵌套查询的时候子查询出来的的结果是作为一个派生表来进行上一级的查询的,所以子查询的结果必须要有一个别名
把MySQL语句改成:select count(*) from (select * from list where name="xiao") as t;
问题就解决了,虽然只加了一个没有任何作用的别名t,但这个别名是必须的!
Every derived table must have its own alias
每个派生表必须有自己的别名
sql= '''
select Novel_name from (select Novel_name from
qishu\_books\_sort010
GROUP BY Novel_name ORDER BY Novel_ID ASC) as twhere Novel_name not in (select TXT_name fromqishu\_detail\_sort010
);'''
SELECT * FROM
(SELECT 1 CorpLevel,t.Operator_Id CorpId,t.Operator_Name CorpName,'1' CorpType FROM Fd_Operator t
UNION ALL
SELECT 2 CorpLevel,t.Con_Id CorpId,t.Con_Name CorpName,'2' CorpType FROM Fd_Consignor t
UNION ALL
SELECT 2 CorpLevel,t.Carrier_Id CorpId,t.Carrier_Name CorpName,'3' CorpType FROM Fd_Carrier t
UNION ALL
SELECT 3 CorpLevel,t.Ssa_Id CorpId,t.Ssa_Name CorpName,'4' CorpType FROM Fd_SupplySalesagency t)
AS a WHERE a.CorpId='129;'