SELECT answer into @a from progress where id = 1;
SELECT answer into @b from progress where id = 2;
SELECT answer into @c from progress where id = 3;
SET @query = CONCAT('select ?, ?, ', @c);
PREPARE stmt1 from @query;
EXECUTE stmt1 using @a, @b;
I would like to write the equivalent of this using the codeigniter model but I can't work out how to do it.
My database looks like this:
table name: progress
id label_id answer
1 1 5
2 2 10
3 3 @a+@b
table name: master
id label
1 a
2 b
3 c
Can anyone suggest how this would be done?
Thanks in advance.