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)

相关推荐
摘星怪sec33 分钟前
【漏洞复现】|方正畅享全媒体新闻采编系统reportCenter.do/screen.do存在SQL注入
数据库·sql·web安全·媒体·漏洞复现
基哥的奋斗历程42 分钟前
学到一些小知识关于Maven 与 logback 与 jpa 日志
java·数据库·maven
苏-言1 小时前
MyBatis最佳实践:提升数据库交互效率的秘密武器
数据库·mybatis
gyeolhada1 小时前
计算机组成原理(计算机系统3)--实验八:处理器结构拓展实验
java·前端·数据库·嵌入式硬件
码农丁丁1 小时前
为什么数据库不应该使用外键
数据库·mysql·oracle·数据库设计·外键
随心Coding3 小时前
【MySQL】存储引擎有哪些?区别是什么?
数据库·mysql
m0_748237054 小时前
sql实战解析-sum()over(partition by xx order by xx)
数据库·sql
dal118网工任子仪5 小时前
61,【1】BUUCTF WEB BUU XSS COURSE 11
前端·数据库·xss
萌小丹Fighting6 小时前
【Postgres_Python】使用python脚本批量创建和导入多个PG数据库
数据库
青灯文案16 小时前
Oracle 数据库常见字段类型大全及详细解析
数据库·oracle