当前位置:网站首页 > SQL数据库编程 > 正文

sqlserver while循环(sqlserverwhile循环表)



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)
 

到此这篇sqlserver while循环(sqlserverwhile循环表)的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • sql文件格式(sql文件格式后缀)2024-12-30 10:18:06
  • sql文件在哪里(sql数据库文件在哪)2024-12-30 10:18:06
  • sqlldr只导入指定字段(sqlldr导入字段有换行符)2024-12-30 10:18:06
  • sql中循环更新对应主键的时间(sql中循环更新对应主键的时间是什么)2024-12-30 10:18:06
  • sql数据文件存放位置(sqlyog数据库文件存放在哪里)2024-12-30 10:18:06
  • sql文本格式(sql文本格式转化为日期格式)2024-12-30 10:18:06
  • sql窗口函数是什么意思(sql 窗口函数 分析函数)2024-12-30 10:18:06
  • 数据表的增删改查sql语句(数据库表增删改查)2024-12-30 10:18:06
  • pymysql怎么安装(pymysql如何安装)2024-12-30 10:18:06
  • mysql主键是唯一的吗(mysql中的主键)2024-12-30 10:18:06
  • 全屏图片