首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

SQL语句union all语句的有关问题

2012-07-31 
SQL语句union all语句的问题select deptcode as deptcode, subjcode as subjcode, nfundingneeds as nfund

SQL语句union all语句的问题
select deptcode as deptcode, subjcode as subjcode, nfundingneeds as nfundingneeds, localdebitamount as localdebitamount, flossadj as flossadj, flossvalue as flossvalue, monthcashbgt as monthcashbgt, monthexe as monthexe, monthadj as monthadj, monthbgt as monthbgt from
(select * from TEMQ_GXZYKMY union all select * from TEMQ_GXZYKME union all select * from TEMQ_GXZYKMS union all select * from TEMQ_GXZYKMSi union all select * from TEMQ_GXZYKMW)
as un

大侠们,帮忙看看这段SQL语句里面有什么问题?

[解决办法]

SQL code
SELECT deptcode         AS deptcode,       subjcode         AS subjcode,       nfundingneeds    AS nfundingneeds,       localdebitamount AS localdebitamount,       flossadj         AS flossadj,       flossvalue       AS flossvalue,       monthcashbgt     AS monthcashbgt,       monthexe         AS monthexe,       monthadj         AS monthadj,       monthbgt         AS monthbgtFROM   (SELECT *        FROM   TEMQ_GXZYKMY        UNION ALL        SELECT *        FROM   TEMQ_GXZYKME        UNION ALL        SELECT *        FROM   TEMQ_GXZYKMS        UNION ALL        SELECT *        FROM   TEMQ_GXZYKMSi        UNION ALL        SELECT *        FROM   TEMQ_GXZYKMW ) AS un 确保 TEMQ_XXX 这些表中的 列列类型一直,如果不一直转换成一直的。而且 每个 * 代表的字段数量都一样
[解决办法]
没有问题,你执行报什么错?
[解决办法]
探讨

DB2 SQL error: SQLCODE: -206,
SQLSTATE: 42703,
SQLERRMC: NFUNDINGNEEDS
SQL---就是刚才语句了

[解决办法]
检查下表里面是否有NFUNDINGNEEDS这个字段,或则你是不是拼写错误了

热点排行