超级长得SQL语句,看晕你的头,求大神帮忙看一下这段SQL错在哪里。
                        DECLARE @SQL VARCHAR(8000)
                        SET @SQL ='SELECT A.POINT,
                           A.WZ,
                           A.LC,
                           A.PL1,
                           A.PL2,
                           A.XS1,
                           CASE 
                               WHEN ISNULL(A.ZDZS,'''') <> '''' THEN A.ZDZS
                               ELSE 0
                           END AS ZDZS,
                           CASE 
                               WHEN ISNULL(A.PJZ,'''') <> '''' THEN A.PJZ
                               ELSE 0
                           END AS PJZ,
                           CASE 
                               WHEN ISNULL(A.SSZ,'''') <> '''' THEN A.SSZ
                               ELSE 0
                           END AS SSZ,
                           CASE 
                               WHEN ISNULL(A.ZXZ,'''') <> '''' THEN A.ZXZ
                               ELSE 0
                           END AS ZXZ,
                           CASE 
                               WHEN ISNULL(A.ZXZS,'''') <> '''' THEN A.ZXZS
                               ELSE 0
                           END AS ZXZS,
                           CASE 
                               WHEN ISNULL(A.ZDZ,'''') <> '''' THEN A.ZDZ
                               ELSE 0
                           END AS ZDZ,
                           CASE 
                               WHEN ISNULL(A.MaximumAndTime,'''') <> '''' THEN A.MaximumAndTime
                               ELSE CONVERT(VARCHAR(50),GETDATE(),20)
                           END AS MaximumAndTime,


                         A.SJ  双击后错误指向这里 为 消息 102,级别 15,状态 1,第 36 行

')' 附近有语法错误。

                    FROM('
                        SET @SQL= @SQL + 'SELECT * FROM ('
                        IF OBJECT_ID('FC_M20140608', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-08 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               0 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               0* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               0* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140608 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140609', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-09 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               1 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               1* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               1* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140609 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140610', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-10 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               2 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               2* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               2* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140610 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140611', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-11 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               3 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               3* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               3* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140611 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140612', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-12 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               4 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               4* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               4* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140612 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140613', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-13 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               5 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               5* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               5* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140613 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140614', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-14 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               6 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               6* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               6* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140614 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140615', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-15 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               7 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               7* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               7* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140615 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140616', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-16 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               8 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               8* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               8* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140616 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140617', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-17 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               9 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               9* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               9* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140617 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140618', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-18 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               10 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               10* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               10* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140618 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140619', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-19 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               11 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               11* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               11* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140619 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            IF OBJECT_ID('FC_M20140620', 'U') IS NOT NULL
                            BEGIN
                               SET @SQL = @SQL + 'SELECT ''001A07'' AS POINT,
                               wz.WZ,
                               dev.LC,
                               dev.PL1,
                               dev.PL2,
                               dev.XS1,
                               CONVERT(varchar(50),m.ZDZ) +''\2014-06-20 ''+ CONVERT(varchar(50),m.ZDZS / 3600)+'':''+ CONVERT(varchar(50),(m.ZDZS % 3600)/60)+'':''+CONVERT(varchar(50),(m.ZDZS % 3600) % 60) AS MaximumAndTime,
                               12 * 86400 + m.ZDZS AS ZDZS,
                               m.PJZ,
                               12* 1440 + m.SJ AS SJ,
                               SSZ,
                               ZXZ,
                               12* 86400 + m.ZXZS AS ZXZS,
                               m.ZDZ
                        FROM   FC_M20140620 m INNER
                        JOIN   FC_DEV dev
                          ON   m.DEVID = dev.DEVID
                          INNER
                        JOIN   FC_WZ wz
                          ON   m.WZID = wz.WZID
                        WHERE  m.FZH = 001
                          AND  m.KH = 07 UNION ALL '
                            END
                            SET @SQL = SUBSTRING(@SQL,1,(LEN(@SQL)- 9))
                        SET @SQL = @SQL + ') F) A  ORDER BY SJ '
                        EXEC(@SQL)
0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
这段代码看了让你怀疑人生 网友:不愧是大神写的
先说一下,我是干前端方向的,文章的这个游戏这个是javascript代码写的。 今天逛论坛看到了一位程序员大佬,真的是大佬,写了一个街头霸王游戏,我很早学JavaScript的时候自己也想过写游戏,但是那时候思维技术什么都不是很到位,所以一直没有去写,现在也没有那个闲情去写这个了,当然对于刚学好JavaScript的确是是一个锻炼思维和技术的最好案例,博主写了三天搞定的,这技术,我觉得已经很牛逼...
使用Default Trace查看谁还原了你的数据库?
今天在论坛看到一则帖子,数据库被还原了想查是谁做的。因为操作是远程桌面登录到WINDOWS所以个人觉得很容易找到是谁,根据WINDOWS SECURITY日志和SQL Server日志还原事件就可以找到登录WINDOWS的账户了。但是他们公用一个WINDOWS账户,所以无法查出来(建议不要用共同的WINDOWS账户管理,出了问题很难追踪)。建议查看Restorehistory日志的User_nam
这段SQL语句错在哪里
在每台worker机器都执行大量的不同任务能够提高集的动态的负载均衡能力这时[cpp] view plain copy print,并且确立了安装包增量监控的工具和流程但事情还没有完.同时会计算这个文件每个数据块的校验和,寻找下曲线上与上曲线上相等的值apk不安装发起连线人视角.   较后Maven Central 则是由sonatype维护的Maven仓库,例如那么你看看较后1行使用T
这段SQL语句错在哪里?
sSql:='insert into TEMP_SP_GL_BOOK_T(FISCAL,FIS_PERD,VOU_DATE,VOU_MONTH,VOU_DAY,PERD_ORDER,NOTE,D_EX_RATE,';rn sSql := sSql ||' D_CURR_AMT,D_PRICE,D_QTY,D_STAD_AMT,C_EX_RATE,C_CURR_AMT,C_PRICE,C_QTY,C_STAD_AMT,DR_CR,REC_INDEX)'; rn sSql := sSql ||' select FISCAL,FIS_PERD,VOU_DATE,to_char(VOU_DATE,''MM''),to_char(VOU_DATE,''DD''), 2,''当日小计'', ';rn sSql := sSql || 'decode(sum(D_CURR_AMT) , 0 , 0 , sum(D_STAD_AMT)/sum(D_CURR_AMT)),';rn sSql := sSql || 'sum(D_CURR_AMT),';rn sSql := sSql || 'decode(sum(D_QTY) , 0 , 0 , sum(D_STAD_AMT)/sum(D_QTY)),';rn sSql := sSql || 'sum(D_QTY),sum(D_STAD_AMT),';rn sSql := sSql || 'decode(sum(C_CURR_AMT) , 0 , 0 , sum(C_STAD_AMT)/sum(C_CURR_AMT)),';rn sSql := sSql || 'sum(C_CURR_AMT),';rn sSql := sSql || 'decode(sum(C_QTY) , 0 , 0 , sum(C_STAD_AMT)/sum(C_QTY)) ,';rn sSql := sSql || 'sum(C_QTY),sum(C_STAD_AMT),''平'',(select count(*)+1 from TEMP_SP_GL_BOOK_T) as recindex';rn sSql := sSql || ' from TEMP_SP_GL_BOOK_T';rnrn测试时提示ORA--00937:非单组分组函数rnrnrn多谢!
这段sql语句错在哪里?
SET @strSql='SELECT TOP ' + CAST(@pagesize as varchar) + 'id,cname FROM Allenterprise WHERE cname like '''%+@txt+%''' And show=1 AND ID not in (rn SELECT TOP ' + CAST((@page-1) * @pagesize AS varchar) + ' ID FROM Allenterprise WHERE show=1 ) order by id'rnrnrnAnd show=1 AND ID not in (rn SELECT TOP ' 附近有语法错误。rn
帮忙看看这SQL语句错在哪里?
[code=SQL]DELIMITER $$rnrnDROP PROCEDURE IF EXISTS `test`.`sp_test`$$rnrnCreate Procedure test.SP_Test(rnvTypeID int,rnvTypeName varchar(20)rn)rnbeginrnrndeclare vID int;rndeclare vname varchar(100);rndeclare stop int default 0;rnrndrop table if exists tab;rnCREATE TEMPORARY TABLE tab(rnid int null,rn`name` varchar(100) not nullrn)type=heap;rnrndeclare mycur cursor for select ID,Name from ttest where TypeID=vTypeID or TypeName=vTypeName;rnrndeclare CONTINUE HANDLER FOR SQLSTATE '02000' SET stop=1;rnrnopen mycur;rnfetch mycur into vID ,vname;rnwhile stop <> 1 do rn insert into tab values (vid,vname);rn fetch mycur into vID ,vname;rnend while;rnclose mycur;rnrnselect * from tab;rnrndrop table tab;rnrnend;$$rnrnDELIMITER ;[/code]rn错误是:rn[code=SQL]Error Code : 1064rnYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare mycur cursor for select ID,Name from ttest where TypeID=vTypeID or TypeN' at line 11rn[/code]
帮忙看看我的sql语句错在哪里
我的sql语句如下:rndeclare @prefixname char(100)rn set @prefixname='明'rnselect 姓名 from 名册 where 姓名 like '%'+@prefixname+'%'rn请问我的like语句是不是写错了,查询没结果rn
SQL语句大全 (超级完整版)
SQL语句大全 (超级完整版)SQL语句大全 (超级完整版)SQL语句大全 (超级完整版)
SQL语句统计错误率
2018年的第一篇博客就以此作为开端吧 :D 最近在项目中碰到需要统计类似错误率之类的需求,原本这功能是之前做的,但是最近测的时候发现出了点问题,显示的结果不对。这就比较尴尬了。。。 于是就进行debug,发现之前写的查询SQL有问题,“不通用”,限制条件比较多,想的太复杂了点。 回归需求当你想一个问题的时候想不到好的解决办法的时候或者不好实现某个需求的时候,你就应该回归需求的本身。
求大神帮忙看个sql语句
rnrn把这个access 语法改成sql server的 谢谢了 rnrn[code=sql]SELECT PhotoID, PhotoUrl, PublishDate FROM PhotoInfo, (SELECT FORMAT(PublishDate, 'yyyy-mm-dd') AS PDate, MAX(PhotoID) AS PID FROM PhotoInfo GROUP BY FORMAT(PublishDate, 'yyyy-mm-dd')) t1 WHERE t1.PID=PhotoInfo.PhotoID AND PublishDate>=#2013-10-1 0:00:00# AND PublishDate<#2013-11-1 0:00:00#[/code]
求大神帮忙看看SQL语句错在哪里
SELECT 产品编号,日期,收入 FROM 产品预算表 where 日期 between to_char(sysdate,'YYYY')||'-01-01' and 'sysdate'rnrnrn这个语句是想要查出本年的累计数,现在的出现的问题好像WHERE条件不起作用,求大神帮忙看看,谢谢
SQL 语句 帮助文档
SQL 帮助文档,种种函数 语句什么的 相当齐全
一,如何监控和解决SQL Server的阻塞(1) (当前阻塞)
如何监控和解决SQL Server的阻塞(1) (当前阻塞) 1. 什么是"阻塞"? 阻塞是SQL数据库应用"锁"机制的一个副作用。当一个应用请求针对某个数据库对象(例如全表,某行数据, 或者是某个数据页)加锁后,那么这个锁会阻塞其它的应用请求。这就好像你把家里的大门上了锁,你的老婆没有钥匙,只能等待你回家。她进入房间的请求被你阻塞了,不得不等待,直到你解锁开门。对于数据库来说短暂
SQL经典语句
看SQL语句可以提高SQL,以前自己的SQL语句性能好差,提高SQL语句性能的可以看
根据awr报告查看最慢的sql语句
根据awr报告查看最慢的sql语句 当系统运行了一段时间后,系统基本也趋于稳定了,SQL调优也变了DBA的一个主要的工作内容,很多时候都是通过查看awr报告来检查出有性能瓶颈的SQL语句,通过这个可以很清晰的看到具体运行多少时间、次数、CPU、IO的比例。 但是每次都去查看awr报告是一件很繁琐的事情,如果可以单独的查看哪些有问题的sql,就不用每次都去生成一个awr报告了。dba_his...
各位帮忙看一下这句sql错在哪里
sql = "Update zhuche set password='"&password&"', mobile='"&mobile&"', add='"&add&"', nick='"&nick&"' tel='"&tel&"', zip='"&zip&"', email='"&email&"' Where name='"&name&"'"
帮我看一下一句SQL语句错在哪里?
[code=SQL]rnset v_addj_recently = SELECT MAX ( SDADDJ ) ADDJ1 FROM PRODDTA . F4211 rnWHERE SDADDJ < V_ADDJ AND SDAN8 = P02_AN8 and sdlttr<>980 and sdnxtr >=620rnGROUP BY SDAN8;rn[/code]rn请问以上写法错在哪里?
帮我看一下这个SQL语句错在哪里?
sqlstr = "SELECT [gxm] FROM [laogai] WHERE gfg=" & fg & "and Not [gxm] IN (SELECT [gxm] FROM [laogai] IN " & "'" & txtmb.Text & "'" & ")"rn作用就是查找源数据库laogai表中gfg字段为fg字符串变量的gxm值,但这些值又不是在txtmb.text所代表的数据库中的laogai表中。rn一开始我没有加gfg=" & fg & "and 这个条件时,那个是成功的。
下面这段SQL语句错在哪里?
SELECT cor.*,wbx.TimeStamp FROM mtgConference cor,wbxMMConference wbx WHERE (cor.ConfType =9 ) AND cor.Custom9 like '%%' AND cor.SiteID=211AND cor.COMPANYID=0 AND cor.ConfID=wbx.ConfID(+) GROUP BY cor.StartTime ORDER BY StartTime ASCrnrn出现错误信息如下:rnORA-00979:not a GROUP BY expression
帮我看看这段sql语句错在哪里
string sqlstr = "update computer_equipment set computer_locus='" + locus + "',computer_department='" + department + "',computer_user='" + user + "',computer_room='" + room + "',computer_type='" + type + "',computer_model='" + model + "',computer_sn='" + sn + "',computer_ip='" + ip + "',computer_mac'" + mac + "',computer_os='" + os + "',computer_memory='" + memory + "',computer_display='" + display + "',computer_postscript='"+ps+"' where computer_number='" + number + "'";rnrnrnrn运行后提示数据库错误,错误原因:'' 附近有语法错误。rnrn晕啊实在找不出哪里有问题饿,各位帮帮忙吧谢谢
复杂SQL学习
select * from (select d.*,  rownum r from (select a.req_id req_id,a.imcc_order_id imcc_order_id, to_char(a.input_date,'yyyy-MM-dd') input_date, a.title title, a.approve_dept approve_dept, a.approv
sql语句,求大神帮忙
主从表,FID关联rn主表内容:rnFID FNAME HOUDU MENDIANrn 1 H123 1.2 ABrn 2 H278 1.2 IJrnrn从表内容rnFID FTYPE ALIAS(别名) FPRICE(单价)rn 1 箱包 K186 24rn 1 鞋材 H123 27rn 2 箱包 H278 32rnrn查询结果rnrnFID FNAME HOUDU 箱包 鞋材 箱包单价 鞋材单价rn 1 H123 1.2 K186 H123 24 27rn 2 H278 1.2 H278 32
求大神帮忙 SQL语句的
我的数据库里有一些数据,但是列vcContent中有重复的,但每个事件都有对应的不同的完成度vcCompletePercent,例如30%、40%、50%,我想用SQL语句按照事件选出完成度最大的数据,按照事件分,就是每个事件只选一条(最大的),选出的数据得是此事件的完整信息,就是包括其他的我没提到的列。。。rn 哪位大神可以给个SQL语句~~~
求大神帮忙sql语句
假如公司每个部门本有一个部长和副部长位置,寻找公司员工张三部门的领导副部长姓名,如果该员工部门副部长没有人,则寻找部长姓名
sql语句错在哪里?
各位高手,小弟有段sql语句如下:rncreate table scu50.tmp1 asrn(rn select rn distinct(trim(Z13_TITLE)) TITLE,rn substr(Z13_ISN,1,15) ISN, rn trim(tmp.NO) NO, rn sum(tmp.TIMES)TIMESrn from rn tmp,Z13rn where Z13_REC_KEY =tmp.RECKEYrn group by Z13_TITLE,substr(Z13_ISN,1,15),tmp.NOrn order by TITLErn);rnrn临时表内的sql语句,单独执行时正确,但创建临时表时就总提示:“order by”前面缺失右括号,这是什么原因呢,各位大哥!
SQL语句错在哪里?
sql="insert into imgbook(classname,bigclassname,smallclassname,title,content,updatetime,"rn sql=sql&"width,height,place,username,usergroup,imgpath) "rn sql=sql&"values ('"&classname&"','"&bigclassname&"','"&smallclassname&"','"&title&"','"&content&"','"&updatetimern sql=sql&"','"&width&"','"&height&"','"&place&"','"&username&"','"&usergroup&"','"&imgpath&"')"rn
求SQL语句
求SQL语句,请看附件
SQL--一条语句,各种嵌套,能看懂的都是大神!
一条语句,各种嵌套,你能看懂吗? sql = &amp;quot;select * from(select * from ( SELECT T_BorrowLog.itemNo,T_Item.itemName,T_Category.categoryName,T_BorrowLog.number,T_BorrowLog.purpose,T_Storage.storageName,T_BorrowLog.positi...
帮忙看一下我的sql语句错在哪了。
select id,uname from sysusers where id inrn(select sysuser_id fromrn(select distinct sysuser_id from docomman where docomexam_id in(select id from docomexam where sysuserid = 4 order by id desc ))rnwhere rownum <=10 );rnrn提示是第三行order by前面缺失右括号
看看我的sql语句错哪里了
SELECT *rnFROM contentrnWHERE (((content.title) LIKE '%MMColParam%') AND ((content.classid) like 'clsssid')) rnrn'%MMColParam%'和'clsssid' 是要获得的变量。rnrn我想实现从一文本框和一列表中获得参数进行查询。没有获得参数时显示content表全部的字段。有两个表class 有字段id classid rn content 有字段id title content classidrnrn望高手指教.
帮忙看一条SQL,错在哪里?
set serveroutput onrndeclare li_count int;rn ls_user varchar2(50);rnbeginrn select user into ls_user from dual;rn dbms_output.put_line (ls_user);rn select count(*) into li_count from dba_tables where OWNER = ls_user and table_name = 'ABC';rn dbms_output.put_line (li_count);rn if li_count > 0 thenrn DROP TABLE ABC ;rn end if;rnend;rnrn报告说 drop table abc ;的地方出错,谢谢!
看原代码,sql语句错在哪里????急!!!!
Sub SetTreeView()rn Dim intRelative1, intRelative2, intRelative3 As Integerrn rn Set dbsContent = OpenDatabase(strDbPath)rn Set datXiaoqu1 = dbsContent.OpenRecordset("select * from 小区表 where 小区代号<>1")rn rn tvwZhuhu.Nodes.Clearrn Do While Not datXiaoqu1.EOFrn Set mNode = tvwZhuhu.Nodes.Add(, tvwLast, datXiaoqu1("小区代号") & "_", datXiaoqu1("小区名称"), "house", "house")rn intRelative1 = mNode.Indexrn Area_id = Val(mNode.Key)rn Set datLouyu = dbsContent.OpenRecordset("select * from 楼宇表 where 小区代号=" & Area_id)rn Do While Not datLouyu.EOFrn Set mNode = tvwZhuhu.Nodes.Add(intRelative1, tvwChild, datLouyu("楼宇代号") & "$", datLouyu("楼宇名称"), "louyu", "louyu")rn intRelative2 = mNode.Indexrn louyu_id = Val(mNode.Key)rn Set datDanyuan = dbsContent.OpenRecordset("select DISTINCT 房屋表.单元id,单元表.单元名称 from 房屋表,单元表,单元表 inner join 房屋表 on 房屋表.单元id=单元表.单元id where 房屋表.楼宇代号=" & louyu_id & " and 房屋表.目前状态id<>1")rn Do While Not datDanyuan.EOFrn Set mNode = tvwZhuhu.Nodes.Add(intRelative2, tvwChild, datDanyuan("单元id") & "<" & louyu_id & ">", datDanyuan("单元名称"), "danyuan", "danyuan")rn intRelative3 = mNode.Indexrn Owner_Id = Val(mNode.Key)rn ''Set datZhuhuB = dbsContent.OpenRecordset("select * from 住户表,房屋表,房屋表 inner join 住户表 on 房屋表.房间代号=住户表.房间代号 where 楼宇代号=" & louyu_id & " and 单元id=" & Owner_Id)rn Dim sb As Stringrn Dim sql1 As Stringrn sb = Format(Curreydate, "yyyy年mm月")rn sql1 = "select * from 住户表,房屋表,收费表 where 房屋表.房间代号=住户表.房间代号 and 住户表.房间代号=收费表.房间代号 and 房屋表.楼宇代号="rn sql1 = sql1 & louyu_id & " and 房屋表.单元id=" & Owner_Id & "and 收费表.收费否= 0 and 收费表.收费月份 =" & sbrn ''这里出错;''''''''''''''''''''''''''''''rn''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''rn'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''rn''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''rn Set datZhuhuB = dbsContent.OpenRecordset(sql1)rn Do While Not datZhuhuB.EOFrn Set mNode = tvwZhuhu.Nodes.Add(intRelative3, tvwChild, datZhuhuB("住户表.房间代号") & "#", datZhuhuB("房屋地址") & "【" & datZhuhuB("户主姓名") & "】", "man", "man")rn datZhuhuB.MoveNextrn Looprn datDanyuan.MoveNextrn Looprn datLouyu.MoveNextrn Looprn datXiaoqu1.MoveNextrn Looprn dbsContent.Closern End Subrn
mybatis日志查看sql语句
在src目录在创建一个log4j.properties资源 ### 全局控制机制 ### log4j.rootLogger = debug , stdout # #log4j日志分为5种级别 # debug 调试(开发阶段) # info 运行信息(测试或者运行阶段) # warn 警告信息 # error 程序错误信息 # fatal 系统错误信息
如何通过sql日志,查看以前执行过的sql语句
使用Log Explorer查看和恢复数据 Log Explorer 4.1.可用于SQL Server2005的日志查看工具 下载地址: http://download.csdn.net/source/620271 使用方法: 打开Log Explorer -> Attach Log File -> 选择SQL Server服务器和登陆方式 -> Connect -> 在Databa
看一下我的SQL错在哪里
create table zl(id varchar[50],spname varchar[50],spprice real[4]);rn编译时它总是提示句法错误
sql面试题java
常见的数据库sql语句,Oracle的sql语句,如果不会的话可以看一下。
帮忙看一下这段代码错在哪里了?…………
我写了这样的一个代码rn[code=Java]rnpublic static void main(String[] args) throws IOException, InterruptedException rn Runtime r = Runtime.getRuntime(); rn Process p = null;rn p = r.exec("exp hit/hit@test file=d://da.dmp tables=(ACE_MEDLIST) ");rn p = r.exec("imp hit/hit@test file=d://da.dmp tables=(ee) ignore=y");rn// p.waitFor(); rn// p.destroy();rn rn[/code]rn就是把orac数据库中的表ACE_MEDLIST 导出到 d://da.dmp 下 rn然后再把da.dmp导入到oracle中的ee这个表中rn现在出现的问题是 这个表可以导出来 但是下面的那个不能导入到ee表中rn不知道是为什么啊?rn还有就是 p = r.exec("exp hit/hit@test file=d://da.dmp tables=(ACE_MEDLIST) ");rn如果加上query以后就不能导出了 也就是rnrnp = r.exec("exp hit/hit@test file=d://da.dmp tables=(ACE_MEDLIST) query=\" where EWDRUGCODE='55289003930'\"");rnrn高手帮忙看一下rnrn
通过SqlServer添加2003超级用户的方法
    如果知道SqlServer的sa的密码,通过SqlServer可以用以下的语句在2003中增加超级用户    use master    exec xp_cmdshell net users tempuser /add    exec xp_cmdshell net localgroup administrators tempuser /add
麻烦帮忙看一下,这段代码错在哪里?
题目:rn第一题:rn构造链表,读入一个电影名称,遍历链表,若已存在,则计数加一,否则在链表末尾追加。rnrn第二题:rn输入数据为两行,上下对齐的为一组。要求找出一个数,该数减去上面一行的数后所得的差可以被下面一行的对应数整除。rn上面一行的整数无限制,下面一行的整数为正数,所求数为非负。rnrn第三题:rn忽略rnrnInput:rnThe input file will consist of series data sets.Each data set has two parts.The first part contains two non-negative integers,n(1<=n<=100000) and m(1<=m<=n),representing the total of numbers you will get and interval of the output sorted list.The second part contains n positive integers.I am sure that each integer in this part will be less than 2000000000.rnrnOutput:rnFor one data set,you should output several numbers in ONE line.After you get the sorted list,you should output the first number of each m numbers,and you should print exact ONE space between two adjacent numbers.And please make sure that there should NOT be any blank line between outputs of two adjacent data sets.rnrnSample Input:rn8 2rn3rn5rn7rn1rn8rn6rn4rn2rn0 0rnrnOutput for the Sample Input:rn1 3 5 7rnrn代码:rn[code=C/C++]#include rn#include rn#include rnrnrnstruct fSTRINGrn char num[11];rn struct fSTRING *next;rn;rnrntypedef struct fSTRING *STRING;rnrnint comp(const void *p,const void *q)rn STRING a,b;rnrn #ifdef DBGrn printf("DBG:In comp().\np is %p and q is %p.\n",p,q);rn #endifrnrn a=*(STRING*)p;rn b=*(STRING*)q;rn #ifdef DBGrn printf("DBG:In comp().\nString p is %s and string q is %s\n",a->num,b->num);rn #endifrnrn return strcmp(a->num,b->num);rnrnrnint main()rn while(1)rn int num_total,num_total_count;rn int interval;rn char str[11],tmp;rn int str_len,str_len_count;rnrn int i,j;rnrn STRING arr_addr[10000];rnrn STRING str_first=malloc(sizeof(struct fSTRING));rn STRING str_current=str_first;rnrn memset(str_first,0,sizeof(struct fSTRING));rn memset(arr_addr,0,sizeof(arr_addr[0])*10000);rnrnrn scanf("%d %d",&num_total,&interval);rn #ifdef DBGrn printf("DBG:Total=%d Interval=%d\n",num_total,interval);rn #endifrnrn if(num_total==0) return 0;rn rn str_current=str_first;rn for(num_total_count=1;num_total_count<=num_total;num_total_count++)rn scanf("%s",str);rn #ifdef DBGrn printf("DBG:str is %s\n",str);rn #endifrnrn str_len=strlen(str);rnrn for(str_len_count=0;str_len_countnum,str);rn str_current->next=malloc(sizeof(struct fSTRING));rn memset(str_current->next,0x00,sizeof(struct fSTRING));rn str_current=str_current->next;rnrn rnrnrn #ifdef DBGrn str_current=str_first;rn while(1)rn if(str_current->next==NULL) break;rn printf("DBG:Num is %s\n",str_current->num);rn str_current=str_current->next;rn rn #endifrn rn /* Save all link table node address into a array */rn str_current=str_first;rn for(num_total_count=0;num_total_countnext;rn rnrn #ifdef DBGrn printf("DBG:Sorting...\n");rn printf("DBG:sizeof(arr_addr[0]):%d\n",sizeof(arr_addr[0]));rn #endifrnrn qsort(arr_addr,num_total,sizeof(arr_addr[0]),comp);rnrn #ifdef DBGrn for(num_total_count=0;num_total_countnum);rn rn #endifrnrnrn i=1;rn for(num_total_count=0;num_total_countinterval)rn if(i!=1) printf(" ");rn for(j=0;j<10;j++)rn if(arr_addr[num_total_count]->num[j]!='0')rn break;rn rn rn for(;j<10;j++)rn printf("%c",(arr_addr[num_total_count]->num)[j]);rn rn i=1;rn rn i++;rn rn printf("\n");rn rn return 0;rn[/code]rnrn每次提交都是Wrong Answer...rn谢谢谢谢
帮忙看一下这段代码哪里错呀
sb.Append ( "
文章热词 设计制作学习 机器学习教程 Objective-C培训 交互设计视频教程 颜色模型
相关热词 mysql关联查询两次本表 native底部 react extjs glyph 图标 哪里看区块链价格 区块链eos哪里看价格