I think you can do this in pure SQL. Here is my attempt:
CREATE TABLE newTable (
`id` INT
, `remoteid` INT
, `value_a` INT
, `value_b` INT
, `value_c` INT
, `when` DATE
)
SELECT
`id`
`remoteid`
, MAX(IF(`type`='a', `value`,
Hi,
Thank you Laercio.
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 wit
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 a
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: