当前位置:网站首页>Order by keyword syntax problems encountered in SQL Server learning
Order by keyword syntax problems encountered in SQL Server learning
2022-06-25 21:17:00 【CSDN Q & A】
background
At night sql Examples seen during the basic tutorial , Write it on the computer and keep reporting errors
select product_id,product_name,sale_price, sum(sale_price) over(partition by product_type order by product_price) as current_sum from product;select product_id,product_name,sale_price, avg(sale_price) over(order by product_id) as current_avg from product;Operation results and error reporting contents
news 102, Level 15, state 1, The first 2 That's ok
'order' There are grammar errors nearby .
The error contents of both statements have been order There are grammatical errors at , But I don't know what's going on . I hope you can get an answer .
Take the answer :
Your mistake is inevitable , because COUNT(),SUM(),AVG(),MAX(MIN() All belong to aggregate functions , Aggregate windowing function can only use PARTITION BY Clause or without any statement ,ORDER BY Cannot be used with aggregate windowing function .
Grammatical structure : Aggregate functions ( ) OVER ( [ <partition_by Clause > ] )
So you used order by It's wrong. , You can refer to this article for more information , I hope it helps you
边栏推荐
- [machine learning] machine learning from zero to mastery -- teaching you how to use decision tree to predict contact lens types
- [important notice] developer document update (12.13-12.19)
- 炒股票用指南针安全还是用证券软件安全?哪里可以开户怎么开
- Heavy update! Yolov4 latest paper! Interpreting yolov4 framework
- Cross project measurement is a good helper for CTOs and PMOS
- [machine learning] machine learning from zero to mastery -- teach you to understand the principle of decision tree
- Illustrated with pictures and texts, 700 pages of machine learning notes are popular! Worth learning
- Vbpr (visual Bayesian personalized ranking) paper summary
- Finger collar pin exclusive Medal
- Idea implements hot deployment
猜你喜欢

109 practical shell scripts

Docker failed to remotely access 3306 after installing MySQL
Yunzhisheng atlas supercomputing platform: computing acceleration practice based on fluid + alluxio (Part 2)

Yolov4 reading notes (with mind map)! YOLOv4: Optimal Speed and Accuracy of Object Detection

1.0-mq getting started and using

A simple file searcher

Explain memcached principle in detail

Jingxi Pinpin wechat applet -signstr parameter encryption
![[buucry] sensor (Manchester code)](/img/ab/066923f1aa1e8dd8dcc572cb60a25d.jpg)
[buucry] sensor (Manchester code)

Volatile qualifier
随机推荐
Analysis and cleaning of kdevtmpfsi virus content
Data query of server SQL. The most important chapter in database learning
On merging and sorting
Yolov4 improved version comes out! Yolov4 extended edition! Yolov4 launched scaled-yolov4: scaling cross stage partial network
Svn various color states
What is ARP (address resolution protocol)? (Powercert animated videos)
Installing and configuring redis under Linux
js (1)
Yunzhisheng atlas supercomputing platform: computing acceleration practice based on fluid + alluxio (Part 2)
109 practical shell scripts
Shell scripts: Variables
[nailing scenario capability package] smart office phone
How to solve the problem of flash write protection in STM32?
MySQL is slow to add indexes_ Why is your SQL so slow? Why is your MySQL index invalid?
[nailing scenario capability package] manage the on-the-job / off-the-job situation of employees
Those high-frequency and real software test interview questions sorted out by the test director in 7 days, come to get
Getting started and using postman
Decryption of APP parameters of a cross-border export e-commerce - dunhuang.com
How to buy the millions of medical insurance for children? How much is it a year? Which product is the best?
STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)