Re: Interresting update problem

2007-06-27 Thread Dan Buettner
What I've done in situations like this is write SQL that generates the SQL I need. I then pipe out to a file and pipe it back in, or just pipe from one instance of mysql to another. Example SQL: SELECT CONCAT('UPDATE main SET ', field, ' = ', id, ';') AS update_sql FROM map Example command to

Interresting update problem

2007-06-27 Thread Mogens Melander
Hi all, I'm trying to wrap my brain around folowing problem. table main(code, field_1, field_2, field_3, , , field_51) 111, 'X', '', 'X',,, 222, '', '', 'X',,, 333, '', 'X', '' ,,, 444, '', '', '' ,,, 555, 'X','X', '' ,,, table map(id, field) 1, 'field_1' 5, 'field_2' 9, 'field_3'