Reply to Re: Combine multiple records into single row

Your name:

Reply:


Posted by Matt F on 03/30/07 21:08

Actually the Answer Table doesn't have the AnswerType





On Mar 30, 2:29 pm, Ed Murphy <emurph...@socal.rr.com> wrote:
> Matt F wrote:
> > VoterID AnswerText AnswerID
> > 5 Comments here 2058
> > 5 <NULL> 2057
> > 5 <NULL> 2059
>
> > AnswerID is found in the Answer table which corresponds (in this case)
> > to 2057="Technology" and 2059="Satisfied"
>
> > What I need is one recordset with the following format.
>
> > VoterID Department Rating
> > ---------- ----------------- ------------
> > 5 Technology Satisfied
>
> Insert standard "post the CREATE TABLE statement for the Answer table"
> rant here. Assuming that it looks something like this:
>
> AnswerID | AnswerType | AnswerValue
> ---------+------------+------------
> 2057 | Department | Technology
> 2059 | Rating | Satisfied
>
> then you can do:
>
> select va.VoterID,
> ad.AnswerValue as Department,
> ar.AnswerValue as Rating
> from VoterAnswers va
> join Answer ad on va.AnswerID = ad.AnswerID
> and ad.AnswerType = 'Department'
> join Answer ar on va.AnswerID = ar.AnswerID
> and ar.AnswerType = 'Rating'- Hide quoted text -
>
> - Show quoted text -

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация