当前位置:网站首页>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
边栏推荐
- Cvpr2020 | the latest cvpr2020 papers are the first to see, with all download links attached!
- 同花顺app是正规的吗?到底安不安全
- The difference between strcpy and memcpy
- What is an app circle of friends advertisement
- On dynamic programming
- "Developer theory" multi system integrated development - rapid nailing of enterprise owned systems
- Get parameters in URL
- The user name and password will be automatically filled in when adding a form
- The correct way to clear the cache of the computer. The computer will not get stuck immediately after changing. practical
- Working principle and experimental analysis of DHCP
猜你喜欢
Summary of several methods for FPS calculation
MySQL installation tutorial
Getting started and using postman
Flexible scale out: from file system to distributed file system
Cvpr2020 | the latest cvpr2020 papers are the first to see, with all download links attached!
After 20 days' interview, I finally joined Ali (share the interview process)
Uncover n core 'black magic' of Presto + alluxio
QT method of exiting application (exe)
Command 'GCC' failed with exit status 1 when PIP install mysqlclient
[nailing scenario capability package] enterprise and public institution intelligent access control
随机推荐
Send a more awesome website, which can convert curl commands into code in any language
8 minutes to understand the wal mechanism of tdengine
The difference between strcpy and memcpy
STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)
Installing and configuring redis under Linux
Legal mix of settlements (utf8mb4_0900_ai_ci, implicit) and (utf8mb4_general_ci, implicit) error resolution
Yolov4 improved version comes out! Yolov4 extended edition! Yolov4 launched scaled-yolov4: scaling cross stage partial network
IPv4 and IPv6 (powercert animated videos)
QT method of exiting application (exe)
[important notice] developer document update (12.13-12.19)
04 disk space management
JS__ Inheritance mode, namespace, object enumeration__ Duyi
Illustration tcp/ip - Chapter 1 and 2 Notes
Shell syntax
Summary of several methods for FPS calculation
Xshell mouse configuration
股市小白通过网上进行股票开户安全吗?
How to buy the millions of medical insurance for children? How much is it a year? Which product is the best?
Node installation method you don't know
Data query of server SQL. The most important chapter in database learning