开发者

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

开发者 https://www.devze.com 2023-01-22 11:02 出处:网络
eg. i have records like this in my table. NameDateSalary Raja01/10/20005000 Raja02/10/20005000 Raja03/10/20005000

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

精彩评论

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