Displaying the results of a query in matrix format (pivot table)
Today I came across an unusual request, I had to query the database and return the values in a pivot table format (variable columns). That’s kind of easy to do if you are using Sql Reporting, but I had never had to display a gridview in this format. After some research, I was able to find and article on Uma Chandar’s site doing just this: here
create table #tb (record_id int, obj_id char(4), reference char(10))
insert #tb values(1, ‘Btn1′, ‘forward’)
insert #tb values(1, ‘Btn2′, ‘backward’)
select
record_id,
min(case when obj_id = ‘btn1′ then reference end) as btn1,
min(case when obj_id = ‘btn2′ then reference end) as btn2
from #tb
group by record_id
I hope this helps.
July 22, 2010 at 2:31 am
< blockquote >< a href=”http://medicamentspot.com/”>MedicamentSpot.com. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. Online Pharmacy. Order pills online< /a >…
Buy:Lasix.Lipothin.Female Cialis.Cozaar.Zocor.Seroquel.Female Pink Viagra.Nymphomax.Ventolin.Advair.Buspar.Lipitor.Acomplia.SleepWell.Zetia.Benicar.Wellbutrin SR.Amoxicillin.Aricept.Prozac….
August 29, 2010 at 6:31 am
easel http://cartsb6fgal.AUTOTECHGUIDE.INFO/tag/uk+easel+R2/ : easel…
easel…
August 29, 2010 at 7:12 am
Waffle http://wacer0fu-h.ABABYCLOTHES.INFO/tag/cafe+Waffle+waffle/ : cafe…
Waffle…
August 29, 2010 at 5:46 pm
Den http://davedamjmqlni.APTAUTOPARTS.INFO/tag/Den+Clip+fire/ : Clip…
Den…
August 29, 2010 at 9:57 pm
Medical http://tcheapz1e.ABABYCLOTHES.INFO/tag/Medical+Cheap+cheap/ : Cheap…
Cheap…