开发者

i have some records in with different total. i want to sum it and display it in single row

eg. i have records like this in my table.

  Name     Date        Salary
  Raja     01/10/2000   5000
  Raja     02/10/2000   5000
  Raja     03/10/2000   5000
  Anu      01/10/2000   3000
  Anu      02/10/2000   3000
  Anu      03/10/2000   3000
  King     01/10/2000   4000
  King     02/10/200开发者_StackOverflow中文版0   4000
  King     03/10/2000   4000

i want to take print like the below eg using crystal report. (sum all the salary and display in single row).

Salary from 01/10/1981 To 03/10/1981

  NAME      Salary
  Raja      15,000
  Anu        9,000
  King      12,000


use a simple sql statement, with group-by clause and sum on the salary column.

select Name, Sum(salary) 
from table
group by Name
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜