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.
Author |
Topic |
kond.mohan
Posting Yak Master
213 Posts |
Posted - 2013-05-31 : 10:09:52
|
i have written one query for Static report purpose. empname is same for multiple amounts.we need to show the empname for once for different amounts.report coming ritht nowamar bahadusingh 9000amar bahadusingh 80amar bahadusingh 645455amar bahadusingh 7843expected format amar bahadusingh 9000 80 645455 7843sameple query .Amar BahadurSingh Nagpur Nagpur Jain Lime & Hardware (L.F) - NSD Wall Putty 261807.00Amar BahadurSingh Nagpur Nagpur Pyramid Incorporation (L.Finish) - Wall Putty 0.00Amar BahadurSingh Nagpur Nagpur Shoeb Khan (L.F) - NSD Wall Putty 23850.00Amar BahadurSingh Nagpur Nagpur SIMON THOMAS VARGHESE Wall Putty 97200.00Amar BirPalta Hyderabad Hyderabad HO Samples Adhesive 0.00Amar BirPalta Hyderabad Hyderabad HO Samples Application Tools 0.00Amar BirPalta Hyderabad Hyderabad HO Samples GROUT 0.00Amar BirPalta Hyderabad Hyderabad HO Samples LATEX 0.00Amar BirPalta Hyderabad Hyderabad HO Samples STONE CARE 0.00 |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-31 : 10:16:30
|
quote: Originally posted by kond.mohan i have written one query for Static report purpose. empname is same for multiple amounts.we need to show the empname for once for different amounts.report coming ritht nowamar bahadusingh 9000amar bahadusingh 80amar bahadusingh 645455amar bahadusingh 7843expected format amar bahadusingh 9000 80 645455 7843sameple query .Amar BahadurSingh Nagpur Nagpur Jain Lime & Hardware (L.F) - NSD Wall Putty 261807.00Amar BahadurSingh Nagpur Nagpur Pyramid Incorporation (L.Finish) - Wall Putty 0.00Amar BahadurSingh Nagpur Nagpur Shoeb Khan (L.F) - NSD Wall Putty 23850.00Amar BahadurSingh Nagpur Nagpur SIMON THOMAS VARGHESE Wall Putty 97200.00Amar BirPalta Hyderabad Hyderabad HO Samples Adhesive 0.00Amar BirPalta Hyderabad Hyderabad HO Samples Application Tools 0.00Amar BirPalta Hyderabad Hyderabad HO Samples GROUT 0.00Amar BirPalta Hyderabad Hyderabad HO Samples LATEX 0.00Amar BirPalta Hyderabad Hyderabad HO Samples STONE CARE 0.00
This is easier to do on the reporting side - in SSRS, for example, if that is what you are using. If you want to do this in SQL,SELECT CASE WHEN RN = 1 THEN [name] ELSE '' END AS [Name], AmountFROM(SELECT [name],[amount], ROW_NUMBER() OVER (PARTITION BY [name] ORDER BY amount) AS RN -- order by whatever criteria you wantFROM YourTable)s ORDER BY RN -- or some other criteria |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-01 : 05:43:42
|
In reporting side its just a matter of setting property Hide Duplicates for textbox showing name------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|