![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, Using SQL 2005. Columns: ID, int (PK, auto-increment by 1) WorkHours, int Name, varchar(100) I can't seem to get the following query to work. I want to return all Names and the sum of ALL work hours, in each row and order by each INDIVIDUAL work hour: SELECT Name, SUM(WorkHours) as h FROM Employers ORDER BY WorkHours DESC It seems that putting WorkHours in but the aggregate function and the ORDER BY clause creates a problem. Thank you for your help! |
#3
| |||
| |||
|
|
Hello, Using SQL 2005. Columns: ID, int (PK, auto-increment by 1) WorkHours, int Name, varchar(100) I can't seem to get the following query to work. I want to return all Names and the sum of ALL work hours, in each row and order by each INDIVIDUAL work hour: SELECT Name, SUM(WorkHours) as h FROM Employers ORDER BY WorkHours DESC It seems that putting WorkHours in but the aggregate function and the ORDER BY clause creates a problem. Thank you for your help! |
#4
| |||
| |||
|
|
Using SQL 2005. Columns: ID, int (PK, auto-increment by 1) WorkHours, int Name, varchar(100) I can't seem to get the following query to work. I want to return all Names and the sum of ALL work hours, in each row and order by each INDIVIDUAL work hour: SELECT Name, SUM(WorkHours) as h FROM Employers ORDER BY WorkHours DESC It seems that putting WorkHours in but the aggregate function and the ORDER BY clause creates a problem. |
![]() |
| Thread Tools | |
| Display Modes | |
| |