php - Is a cursor the only way to do this? -
i'm in process of churning through raw data have. data in mysql database. data lists, in millisecond-by-millisecond format, of number of possible 'events' happening. has few columns:
- id - unique identifier row
- event - indicates event occurring
what basic information regarding these data. specifically, i'd create table has:
- the id event starts
- the id event ends
- a new id indexing events , occurrence, column detailing event happening.
i know easy deal using php, using simple loop through records, i'm trying push boundaries of mysql knowledge bit here (it may dangerous, know!!).
so, question this: cursor best thing use this? ask because events can occur multiple times, doing grouping event type won't work - or it? i'm wondering if there clever way of dealing have missed, without needing go through each row sequentially.
thanks!
to demonstrate commented earlier about, have following table:
event_log id int not null auto_increment primary key start datetime event varchar(255) # or whatever want datatype gathering information simple as:
select el.*, (select el_j.start # - event_log el_j # | el_j.id > el.id # |- grab next row based on next id limit 1) end # - event_log order start;
Comments
Post a Comment