Groups | Blog | Home
all groups > sql server mseq > may 2004 >

sql server mseq : Assing rows to a table



John
5/24/2004 5:06:54 PM
I have a table where the columns are products and the
rows are customers. It stores sales info by customer and
product. I would like to add a row at the bottom af my
customer list that would be used for totaling each
Vishal Parkar
5/25/2004 2:49:29 PM
hi john,

if i understand you correctly you are looking for COMPUTE BY clause of
SELECT statement.
you can check the resultset of following query on northwind database.

use northwind
go
select b.customerid, a.unitprice
from [order details]a join orders b
on a.orderid =b.orderid
order by b.customerid
compute sum (a.unitprice ) by b.customerid
go

if this is not what you want pls post relevent table structure, sample
records, and expected result set out of it.Also specify whether you can
looking for in INSERT /UPDATE/SELECT statment.

--
Vishal Parkar
vgparkar@yahoo.co.in | vgparkar@hotmail.com


AddThis Social Bookmark Button