Subject | SQL - How to ? |
---|---|
Author | Michael Vilhelmsen |
Post date | 2004-10-07T12:16:03Z |
Hi
I have a table containing 9 records.
Those are:
Type,Number,Amount
0,1200,1111
0,1200,2222
0,1300,3333
0,1300,4444
1,1500,5555
1,1500,6666
1,1600,7777
2,1200,8888
3,1300,9999
I would like to select those records, but those of type 0 and same
number should be a SUM(Amount).
The rest - just as they are.
Result should be
0,1200,3333
0,1300,7777
1,1500,5555
1,1500,6666
1,1600,7777
3,1200,8888
3,1300,9999
Maybe Am just tired but I can't seem to write the prober SQL.....
Anyone ?
Michael
I have a table containing 9 records.
Those are:
Type,Number,Amount
0,1200,1111
0,1200,2222
0,1300,3333
0,1300,4444
1,1500,5555
1,1500,6666
1,1600,7777
2,1200,8888
3,1300,9999
I would like to select those records, but those of type 0 and same
number should be a SUM(Amount).
The rest - just as they are.
Result should be
0,1200,3333
0,1300,7777
1,1500,5555
1,1500,6666
1,1600,7777
3,1200,8888
3,1300,9999
Maybe Am just tired but I can't seem to write the prober SQL.....
Anyone ?
Michael