当前位置:网站首页>Nested if statement in sum function in SQL Server2005
Nested if statement in sum function in SQL Server2005
2022-06-30 07:06:00 【CSDN Q & A】
The phenomenon and background of the problem
Want to watch 【MouldDetail】 Pass through SUM Function query column 【 Production quantity 】 Of 2 results
1、 Total quantity of production quantity SUM( Production quantity ), Completed
2、 Historical data of production quantity ( To eliminate SUM( Production quantity ) in <0 That's all ), But the statement is SUM(IF( Production quantity >0, Production quantity ,0) Has been an error .
Table structure :

My sentence is :
select models , Die No ,SUM( Production quantity )' Total quantity ',SUM(IF( Production quantity )>0, Production quantity ,0)' The historical data ' from MouldDetail GROUP BY models , Die No
SUM(IF( Production quantity )>0, Production quantity ,0)' The historical data ' There are always errors reported here , It is no problem to remove this paragraph .
The error message is :
news 156, Level 15, state 1, The first 1 That's ok
keyword 'IF' There are grammar errors nearby .
news 102, Level 15, state 1, The first 1 That's ok
',' There are grammar errors nearby .
Please help us find out what the mistake is ?
边栏推荐
- If I am in Zhuhai, where can I open an account? In addition, is it safe to open a mobile account?
- [Hot100]回文子串 与 最长回文子串
- Use of sscanf function
- Essence of signal slot macros signal and slot
- Linux服务器安装Redis
- 社招两年半10个公司28轮面试面经
- 成品升级程序
- [docsify basic use]
- QT signal slot alarm QObject:: connect:cannot connect (null)
- failed to create symbolic link ‘/usr/bin/mysql’: File exists
猜你喜欢

Daemon and user threads

【最全】linux服务器上安装Mysql
![[Hot100]回文子串 与 最长回文子串](/img/a5/10dec640f02023c4d55cb42e6309fb.png)
[Hot100]回文子串 与 最长回文子串

Go语言指针介绍

ROS service communication programming

1285_ Expand macros defined by AUTOSAR functions and variables with scripts to improve readability

Relevant database questions.

Mysql5.7 compressed version installation tutorial

Record one time of Tencent Test Development Engineer's automation interface test practice experience

ROS-URDF
随机推荐
June 29, 2022 -- take the first step with C # -- add decision logic to the code using the "if", "else" and "else if" statements in C #
【Hot100】11. 盛最多水的容器
Four great happenings on earth
How does the CPU recognize the code?
【我的OpenGL学习进阶之旅】关于OpenGL的着色器的向量和矩阵分类的访问方式: xyzw/rgba/stpq以及数组下标
RT thread migration to s5p4418 (IV): thread synchronization
Determine whether the picture is in JPG picture format
QT signal slot alarm QObject:: connect:cannot connect (null)
Realization of dissolve effect in unity and its principle analysis
Definition and use of ROS topic messages
What underlying technologies support the metauniverse?
2021-07-02
Ffmplay is not generated during the compilation and installation of ffmpeg source code
ftplib+ tqdm 上传下载进度条
[semidrive source code analysis] [x9 chip startup process] 34 - RTOS side display module SDM_ display_ Init display initialization source code analysis
Installation du serveur linux redis
[hot100] palindrome substring and longest palindrome substring
Porting RT thread to s5p4418 (II): dynamic memory management
JS null judgment operators | and? Usage of
[daily question] 535 Encryption and decryption of tinyurl