Sqlite Query To Group Columns
I want to write a query to group my two columns based on third column and show result in a row as shown below in SQLite CAn anybody guide me how can I write query for such structu
Solution 1:
If these are always coming through in increments of 5 minutes
SELECT t1.variable_col, t1.timecomes_col, t2.timegoes_col
FROM Table1 t1
LEFTOUTERJOIN Table1 t2 ON
t1.variable_col = t2.variable_col
AND t1.timecomes_col < t2.timegoes_col AND
t2.timegoes_col < DATETIME(t1.timecomes_col, '+6 minutes')
It might be helpful to add some sample data where this and other more traditional sql would fail to meet your needs. I assume there is a reason you are thinking of Window Functions to solve the issue, but given your sample data there doesn't appear to be a need for them.
Post a Comment for "Sqlite Query To Group Columns"