Prev: backup
Next: move data
From: visweswaran28 via SQLMonster.com on
hi,

let consider,

A table has following fields,

name
amount
date

I know to get sum of amount based for particular date

condition be..

select sum(amount) as val from table_name where date='06-16-2010'

Same as I want to get list of name for a particular date.

How can I achieve this..

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201006/1

From: obiron via SQLMonster.com on
select date, sum(amount) from table where date = '20100616' group by date

If you want by name as well

select name,date, sum(amount) from table where date = '20100616' group by
name,date

Obiron

visweswaran28 wrote:
>hi,
>
>let consider,
>
>A table has following fields,
>
>name
>amount
>date
>
>I know to get sum of amount based for particular date
>
>condition be..
>
>select sum(amount) as val from table_name where date='06-16-2010'
>
>Same as I want to get list of name for a particular date.
>
>How can I achieve this..

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/201006/1

 | 
Pages: 1
Prev: backup
Next: move data