Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
prettyjenny
Yak Posting Veteran
57 Posts |
Posted - 2005-02-04 : 13:31:27
|
| Hello friends,I am trying to create a QUERY to use GROUP BY and sum in CF, this is a table:EMPID EMP_CHARGE_NO EMPSAL 001 SA001 20 002 SA001 23 003 SA001 29 004 AT22 28 005 AT22 30 I am trying to use GROUP BY to SUM empsal by EMP_CHARGE_NO.This is my query, but doesn’t work. SELECT EMP_CHARGE_NO, SUM(EMPSAL) AS TOTALFROM EMPGROUP BY EMP_CHARGE_NOI am trying to get this result:EMP_CHARGE_NO TOTAL SA001 72 AT22 58 I don't know why, it keeps getting errors.Please help.Thanks,Jenny.There is no stupid question.www.single123.com |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-02-04 : 13:38:54
|
| That looks right to me. What error message are you getting? What datatype is EMPSAL?This is SQL server right, and not Oracle?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
|
prettyjenny
Yak Posting Veteran
57 Posts |
Posted - 2005-02-04 : 13:56:56
|
| What I tested this query is on Oracle.That's why.It worked now in SQL.thanks,Jenny.There is no stupid question.www.single123.com |
 |
|
|
|
|
|