mysql - SQL > Select multiple rows for single result -
i have above table, need is, example based off image, have single row returned show:
ticket id | created | assigned | time difference 2 | 2015-05-31 09:18:44 | 2015-06-03 10:05:00 | $math_result
this image shows 1 example i'd have return each ticket has both 'assigned' time , 'created' time.
i'm not dba , bit beyond limited knowledge. can me on how can accomplish this?
you can use join
find row state "assigned" row in state "created":
select c.ticket_id , c.timestamp , a.timestamp , datediff(a.timestamp, c.timestamp) ticket c join ticket on c.ticket_id = a.ticket_id c.state = 'created' , a.state = 'assigned'
Comments
Post a Comment