Link to home
Start Free TrialLog in
Avatar of Chadak
Chadak

asked on

How to query data vertically and show horizontal data

Hi all!

My_Table
ID             Value     ColumnName   customer
1             'value1'    'name1'           1
2             'value2'    'name2'           1
3             'value3'    'name3'           1
4             'value4'    'name4'           1
5             'value5'    'name5'           1
5             'value1'    'name1'           2

I need to make a query that return this!

Name1   name2  name3   name4  name5
===========================
value1   value2    value3   value4    value5

Can't figure how to return this one, also it would be great if this query would also work in access.

Thx
Chad
SOLUTION
Avatar of stevetheski
stevetheski
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, the access query is fairly straight forward. It's the SQL Server one that's the problem.

In MS Access you will need to use a Cross Tab query. I haven't got Access on this PC, so I can't give you an example, but if you go into the deisgn view and change the query type to cross tab it should be fairly straight forward. Let me know if you need any further info for the Access query.
ok you had me wondering again and i found this article

http://sqljunkies.com/WebLog/mattnunn/archive/2003/08/07/173.aspx

maybe that will work for ya
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chadak
Chadak

ASKER

I don't know what to do here as an answer, no answer solve my problem, but there is some solution provided that answered the question

So still i'll close this question
Thanks guys for the help :)