android - SQLite Sort across columns across tables -
i have 8 tables in sqlite database, each having field called time
time when info inserted in table.
i want perform bring together on time
column such info ordered time
ascending across tables. if theres exact match of time in table record should displayed on same row otherwise empty.
it possible implement total outer joins compound queries, 8 tables, become rather complex.
assuming time
values unique, possible concatenate tables while using null columns come other tables, utilize grouping 1 output row per timestamp, , utilize max() pick out non-null values:
select time, max(name1), max(name2), max(name3), ... (select time, name1, null name2, null name3, ... table1 union select time, null, name2, null, ... table2 union select time, null, null, name3, ... table3 ...) grouping time order time
android sorting join sqlite3 android-sqlite
No comments:
Post a Comment