当前位置:网站首页>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
边栏推荐
- Mutual conversion of CString and char*
- On merging and sorting
- Yolov4 reading notes (with mind map)! YOLOv4: Optimal Speed and Accuracy of Object Detection
- Jingxi Pinpin wechat applet -signstr parameter encryption
- Section 13: simplify your code with Lombok
- Shell syntax
- JS__ Prototype, prototype chain, call/apply__ Duyi
- STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)
- Write a "standard" macro min, which inputs two parameters and returns the smaller one
- couldn‘t be accessed by user ‘_ apt‘
猜你喜欢

What is DNS (domain name server)? (Powercert animated videos)

C language soul torture: do you know the difference between the two?

Using two stacks to realize the function of one queue?

Volatile qualifier

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

Compile 6relayd using the cross compiler
![[nailing scenario capability package] exhibition admission](/img/a1/5900ad0d3c89f21da3a2d96c91943a.jpg)
[nailing scenario capability package] exhibition admission

Decryption of APP parameters of a cross-border export e-commerce - dunhuang.com

05 configuring network parameters

IPv4 and IPv6 (powercert animated videos)
随机推荐
Is flush app regular? Is it safe or not
IPtables
Talking about the foundation of function test today
JS__ This, arguments, cloning, ternary operator__ Duyi
[machine learning] machine learning from zero to mastery -- teach you to recognize handwritten digits using KNN
Differences between modems and routers (powercert animated videos)
Leetcode theme [array] -31- next spread
Mutual conversion of CString and char*
Using two stacks to realize the function of one queue?
How to solve the problem of flash write protection in STM32?
C language: array with length 0
Online yaml to XML tool
JS__ Prototype, prototype chain, call/apply__ Duyi
Ensure the decentralization and availability of Oracle network
On dynamic programming
[deep learning series] - visual interpretation of neural network
Lesson 4 beautifulsoup
Write a "standard" macro min, which inputs two parameters and returns the smaller one
Local variables and global variables in C language
Soft test intermediate simple notes