Analytical Query
问题 Am looking for a single query that can convert the following information in the table name:time :state a :10:00 AM:login b :10:05 AM:login a :10:06 AM:chatting a :10:08 AM:Idle b :10:11 AM:chatting a :10:10 AM:Logout b :10:12 AM:Logout to something like this (given the time range 10 AM to 10:15 AM as the querying period) name: State :Duration a : chatting :2 Minutes a : Idle :2 Minutes b : chatting :1 Minute Can this be done ONLY using SQL? Am using Informix version 11.5 回答1: It can be done