Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-04-2008, 03:25 PM
jerrygarciuh
 
Posts: n/a
Default Merging rows

Hello,

Client has requested that I merge certain rows of data in this table

CREATE TABLE `answer` (
`id` int(11) NOT NULL auto_increment,
`applicant` varchar(255) REFERENCES applicant(id),
`question` int(11) REFERENCES question(id),
`answer` text NOT NULL,
PRIMARY KEY (`id`)
)

The relationship between each question and applicant is unique.

What I need to do is look up each applicant's answers to question 3
and question 4 and merge them into the answer for question 3.

I was feebly trying things like:

UPDATE testAnswer SET answer = CONCAT(
(SELECT answer AS start
FROM testAnswer WHERE question = 3)
UNION
(SELECT answer AS finish
FROM testAnswer WHERE question = 4)
GROUP BY applicant
)

Can anyone point me in the right direction?

TIA

JG
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:24 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.