| |

VerySource

 Forgot password?
 Register
Search
Author: lxyxhl

Ask a few super simple SQL statements:

[Copy link]

0

Threads

126

Posts

73.00

Credits

Newbie

Rank: 1

Credits
73.00

 China

Post time: 2020-9-26 14:30:01
| Show all posts
top 20 percent @departtotal
The top 20 percent is only valid for the entire query result (select sum (number) from table name)

And (select sum (number) from table name) will only return one record, so the result is the same
Reply

Use magic Report

0

Threads

17

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-9-26 20:00:01
| Show all posts
declare @departtotal int
select @departtotal =sum(number) from (select top 20 percent sum(number) from table name) a
Reply

Use magic Report

1

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 India

Post time: 2020-9-27 06:00:01
| Show all posts
Well, I learned a bit
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list