View Single Post

   
  #5 (permalink)  
Old 02-28-2008, 09:35 AM
=?UTF-8?B?VG9tYXN6IFNva8OzbHNraQ==?=
 
Posts: n/a
Default Re: Problem with very long 'create table as select' query

Jerry Stuckle napisał(a):
>> That's not my design - I just work with problems with such designs
>> BTW - how to store data from forms - where each form has 1000
>> questions. Each record is one filled form which contains 1000 answers.

> Read up on database normalization. A much better way would be to have a
> second table with three columns - userid, questionid and answer.


Very interesting.

So we have table:

userid questionid answer

paul 1 0.33333
paul 2 0.45454
paul 3 0.23232
john 1 0.55555
john 2 0.44444
john 3 0.22222

I want to insert new records:

userid questionid answer

paul 4 answer=questionid[1].answer(where userid = paul) +
questionid[2].answer(where userid = paul)
john 4 answer=questionid[1].answer(where userid = john) +
questionid[2].answer(where userid = paul)

Is there a possibility to insert this records in one sql command?

(sorry - I'm not an SQL programmer - I would like to know if this is
hard to write in one sql command)
Reply With Quote