Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 group by display all column info?

Author  Topic 

ocm1
Starting Member

7 Posts

Posted - 2009-11-30 : 10:24:24


I want display all column info. pls c my picture.

thk

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-30 : 11:04:42
[code]
select b.*,b1.bookunit,b1.soldout
from table1 b
join (select bookid,count(bookid) as bookunit,sum(soldout) as soldout
from table1
group by bookid) b1
on b1.bookid=b.bookid
[/code]
Go to Top of Page

ocm1
Starting Member

7 Posts

Posted - 2009-12-01 : 00:20:57
thk visakh,

ur code got some mistake, pls check my pic.
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-12-01 : 00:50:33
Hi ocm1

I can't able see your attached picture.

-------------------------
R...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-01 : 01:36:37
select distinct b.*,b1.bookunit,b1.soldout
from table1 b
join (select bookid,count(bookid) as bookunit,sum(soldout) as soldout
from table1
group by bookid) b1
on b1.bookid=b.bookid


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ocm1
Starting Member

7 Posts

Posted - 2009-12-04 : 10:33:00
thk madhivanan,visakh16 :D

I solve my problem al .. i use min(bookname) as bookname, to display my info.

thnak you ....
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-07 : 02:07:18
quote:
Originally posted by ocm1

thk madhivanan,visakh16 :D

I solve my problem al .. i use min(bookname) as bookname, to display my info.

thnak you ....



You are welcome

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -