sqlserver

SELECT T1.* FROM (SELECT 未来之窗.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (SELECT count(Name) order_count,sum(NowPrice) yye,sum(EmpAchieve) yj FROM emp_performance WHERE ( (CreateDate BETWEEN '2024-09-04 00:00:00' AND '2024-11-04 23:59:59' ) ) AND ( EmployeePost = '0001' ) AND ( EmpCode = '006' ) AND ( ItemClass = '00000001' ) AND ( Specify = 0 )) AS 未来之窗) AS T1 WHERE (T1.ROW_NUMBER BETWEEN 1 AND 1)

1> SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (SELECT EmpCode,EmpName,count(Name) order_count,sum(NowPrice) yye,sum(EmpAchieve) yj FROM emp_performance WHERE ( (CreateDate BETWEEN '2024-09-04 00:00:00' AND '2024-11-04 23:59:59' ) ) AND ( EmployeePost = '0001' ) AND ( MemCode = 'notnull' ) GROUP BY EmpCode) AS thinkphp) AS T1

2> go

42000 - [SQL Server]选择列表中的列 'emp_performance.EmpName' 无效,因为该列没有包含在聚合函数或 GROUP BY 子句中。

1> SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (SELECT EmpCode,EmpName,count(Name) order_count,sum(NowPrice) yye,sum(EmpAchieve) yj FROM emp_performance WHERE ( (CreateDate BETWEEN '2024-09-04 00:00:00' AND '2024-11-04 23:59:59' ) ) AND ( EmployeePost = '0001' ) AND ( GuestSex = '女客' ) GROUP BY EmpCode,EmpName) AS thinkphp) AS T1

2> go

+---------+----------+-------------+--------+----------+------------+

| EmpCode | EmpName | order_count | yye | yj | ROW_NUMBER |

+---------+----------+-------------+--------+----------+------------+

| 01 | 吕柯 | 55 | 14083 | 11229.85 | 1 |

| 03 | 力波 | 11 | 1292 | 1069.15 | 2 |

| 05 | 小峰 | 30 | 5140.8 | 4351.86 | 3 |

| 06 | 六小龄童 | 11 | 744 | 653.6 | 4 |

| 201 | 另一 | 37 | 4778 | 4076.55 | 5 |

+---------+----------+-------------+--------+----------+------------+

(5 rows affected)

相关推荐
尘浮生26 分钟前
Java项目实战II基于微信小程序的校运会管理系统(开发文档+数据库+源码)
java·开发语言·数据库·微信小程序·小程序·maven·intellij-idea
偶尔。53527 分钟前
什么是事务?事务有哪些特性?
数据库·oracle
安迁岚29 分钟前
【SQL Server】华中农业大学空间数据库实验报告 实验六 视图
数据库·sql·mysql·oracle·实验报告
xoxo-Rachel38 分钟前
(超级详细!!!)解决“com.mysql.jdbc.Driver is deprecated”警告:详解与优化
java·数据库·mysql
JH30731 小时前
Oracle与MySQL中CONCAT()函数的使用差异
数据库·mysql·oracle
蓝染-惣右介1 小时前
【MyBatisPlus·最新教程】包含多个改造案例,常用注解、条件构造器、代码生成、静态工具、类型处理器、分页插件、自动填充字段
java·数据库·tomcat·mybatis
冷心笑看丽美人1 小时前
Spring框架特性及包下载(Java EE 学习笔记04)
数据库
武子康2 小时前
Java-07 深入浅出 MyBatis - 一对多模型 SqlMapConfig 与 Mapper 详细讲解测试
java·开发语言·数据库·sql·mybatis·springboot
代码吐槽菌3 小时前
基于SSM的毕业论文管理系统【附源码】
java·开发语言·数据库·后端·ssm
路有瑶台3 小时前
MySQL数据库学习(持续更新ing)
数据库·学习·mysql