Link to home
Start Free TrialLog in
Avatar of Mikek5665
Mikek5665

asked on

Desperate - Need to turn columns into rows

I have 2 Microsoft Access databases.  One table has a users information and another has survey questions and their answers.  I need to get the user info and that person's answers into a row.

The tables look like this:

FirstName LastName Address        SurveyNumber  
Joe            Smith      Maple Street    1                        
Juan           Gonzalez  First Street     2


SurveyNumber     Question   Answer
1                        Height         6 foot
1                        Weight        250
2                        Height         6 foot 1

What query and/or report can I write to make it look like this:

FirstName     LastName   Height    Weight                    
Joe               Smith          6 foot      250
Juan             Gonzalez     6 foot 1  

Thank you very much in advance
Avatar of knightEknight
knightEknight
Flag of United States of America image

select U.FirstName, U.LastName, H.Answer, W.Answer
from UserInfo U
join Survey H
  on H.SurveyNumber = U.SurveyNumber
 and H.Question = 'Height'
join Survey W
  on W.SurveyNumber = U.SurveyNumber
 and W.Question = 'Weight'
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland 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
Avatar of Mikek5665
Mikek5665

ASKER

Thank you so much.  The delay in accepting the answer was because I had to get the work done and out the door first.  Yay!!!