[EMAIL PROTECTED] wrote:
BTW, yes, the schema is 'as is' and i have to convert it,
but how to converts rows to columns and add to other
columns? ;-)

I'm not sure I understand this question. Without knowing any details about your problem, I'd suggest something like this. Change tbl from this:

excelid | fld1 | fld2 | ... | fld_n
1           | a     |  b     | ... | n

to this:

excelid | fldname | value
1           | fld1       | a
1           | fld2       | b
...
1           | fld_n      | n

Then your query becomes:

insert into plan (personid, curseid, statid)
select tbl.excelid, curses.id, status.id
from tbl join curses on (curses.fldname = tbl.fldname)
       join status on (tbl.value = status.name);

Igor Tandetnik

Reply via email to