Hy Csongor, You can write this in pure Mysql.
1. First you create a temporary table from your original table events with group by remoteid and when; 2. Create your new table with the fields value_a, value_b and value_c; 3. Populate your new table from your temporary table with 0 in value_* fields; 4. Update the value_* fields from the original table. There may be a simpler way to do this, but I think this is the easyest one. Regards, Laercio Cavalcanti Endless Technology Ltda -----Original Message----- From: Fagyal Csongor [mailto:[EMAIL PROTECTED] Sent: sexta-feira, 3 de setembro de 2004 11:45 To: [EMAIL PROTECTED] Subject: Is this update possible in MySQL? Hi, I have a table that looks like this: table events: id : INT remoteid: INT type : enum ('a','b','c') value: INT when: DATE For each 'remoteid' and 'when', there are 3 rows with type=a,b,c respectively. (Bad table design that is...) I would like to shorten this table so it will look like this: id : INT remoteid: INT value_a: INT value_b: INT value_c: INT when: DATE My idea is to dump this table (it is a quite big table with 10M+ rows), write a perl script to "concatenate" corresponding 'when'+'remoateid' fields, and load the resulting file into another table. Just fo curiosity: can this processing be written in pure MySQL? Thank you, - Csongor -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]