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 2005 Forums
 Transact-SQL (2005)
 Four Rows Per Group.How to implement using groupby

Author  Topic 

tshankar
Starting Member

1 Post

Posted - 2009-03-25 : 02:54:08
i need to implement dynamic rows per group using group by in Select SQL statment
here i pasted sample output. Thanks in Advance
Country LastName FirstName ShippedDate OrderID SaleAmount
UK
Buchanan--------Steven----00:00.0-------10254---556.62
Dodsworth-------Anne------00:00.0-------10255---2490.5
Buchanan--------Steven----00:00.0-------10248---440
Suyama----------Michael---00:00.0-------10249---1863.4
UK
Dodsworth-------Anne------00:00.0-------10263---1873.8
Suyama----------Michael---00:00.0-------10264---695.63
King------------Robert----00:00.0-------11047---817.88
King------------Robert----00:00.0-------11048---525
UK
King------------Robert----00:00.0-------11066---928.75
King------------Robert----NULL----------11074---232.09
USA
Callahan--------Laura-----NULL----------11075---498.1
Peacock---------Margaret--NULL----------11076---792.75
Davolio---------Nancy-----NULL----------11077---1255.72
Davolio---------Nancy-----00:00.0-------11067---86.85
USA
Callahan--------Laura-----NULL----------11068---2027.08
Davolio---------Nancy-----00:00.0-------11069---360
Fuller----------Andrew----NULL----------11070---1629.97
Davolio---------Nancy-----NULL----------11071---484.5
USA
Peacock---------Margaret--NULL----------11061---510

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-25 : 14:20:46
is this for reportinbg purpoose? if yes this format can be very easily achieved using reporting tools
Go to Top of Page
   

- Advertisement -