Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

adding one more column for SubTotal in Select statement

$
0
0
HI EXPERTS,need your help badly.......We have a table with 2 columns 'OrderNo' and 'Amount' as below [b]ORDERNO | AMOUNT[/b]1D1ZX000 | 9262.51D1ZX001 | 9000.01D1ZX001 | 9000.01D1ZX002 | 100001D1ZX003 | 10001D1ZX003 | 200.501D1ZX003 | 100.501D1ZX004 | 500.01D1ZX004 | 10001D1ZX004 | 20001D1ZX004 | 1000as per my client requirement we need subtotal of 'Amount' group by 'OrderNo'. columnso am writing a select statement with WHERE condition and I would like to have another column called SUBTOTAL in the result set (select statement result) with subtotals for that order Numberas below[b]ORDERNO | AMOUNT | SubTotal[/b]1D1ZX000 | 9262.5 | 9262.51D1ZX001 | 9000.0 | 180001D1ZX001 | 9000.0 | 180001D1ZX002 | 10000 | 100001D1ZX003 | 1000.0 | 30011D1ZX003 | 2000.5 | 30011D1ZX003 | 1000.5 | 30011D1ZX004 | 500.00 | 45001D1ZX004 | 1000.0 | 45001D1ZX004 | 2000.0 | 45001D1ZX004 | 1000.0 | 4500please do help me achieve thisThank you

Viewing all articles
Browse latest Browse all 3145

Trending Articles