[quoted text, click to view] "HyperX" <hyper_x_43@yahoo.com> wrote in message
news:4de684ec.0403271932.202b4424@posting.google.com...
> From: hyper_x_43@yahoo.com (HyperX)
> Newsgroups: comp.databases.ms-sqlserver
> Subject: Can anyone please help me with this simple sql?
> NNTP-Posting-Host: 68.72.235.2
> Message-ID: <4de684ec.0403271929.c6ed730@posting.google.com>
>
> Hey guys,
>
> This is a very very simple problem... Can anyone please help me with
> this sql?
> I'm sure some of you would have come across this problem. I'm hitting
> a wall here...
>
> ----------------------My select command Begin...--------------
> Select User, Item, Price, Qty, (Price * Qty) as Total
> From MyTable
> ----------------------My select command End...--------------
>
>
> ----------------------My result set begin...--------------
> user item price qty total
> -------------------------------------
> Raghu xxx p1 1 t1 <---- t1 = sum for all Raghu items
> Raghu yyy p2 2 t1 <---REPETITION - NOT TO BE SHOWN
> Raghu zzz p3 2 t1 <---REPETITION - NOT TO BE
> SHOWN
>
> Velu yyy p2 2 t2 <---- t2 = sum for all velu items
> Velu zzz p3 5 t2 <---REPETITION - NOT TO BE SHOWN
>
> ----------------------My result set END...--------------
>
>
> ----------------My Question--------------
>
> What I basically want is to display the item total for Raghu, Velu
> etc. only once.
>
> so, my DREAM result set should be
>
> ----------------------My DREAM RESULT SET BEGIN...--------------
> user item price qty total
> -------------------------------------
> Raghu xxx p1 1 t1 <---- t1 = sum for all Raghu items
> Raghu yyy p2 2 t1
> Raghu zzz p3 2 t1
> BE SHOWN
>
> Velu yyy p2 2 t2 <---- t2 = sum for all velu items
> Velu zzz p3 5 t2
> ----------------------My DREAM RESULT SET END...--------------
>
>
> Any help is greatly appreciated.
>
> Thanks in advance.
>
> HyperX.
It looks like you've got several responses in another group - please don't
multipost.
Simon