If I have a db with 3 tables A, B, and C. These tables each have a timestamp column.
How can I query the 3 tables to get the row with the least timestamp (closest to now).
I can query each separately and get the minimum timstamp of each table and then do a compare in code but I think there must be a more efficient way.
I want to do it because, I want to schedule an alarm for the NEXT expire date instead of scheduling alarms for all timestamps. I am using SQLITE.
Any help?
I think the best way is to form a unified select query from 3 of them, for example if table A has 3 column and table B has two column , write a three column selection for both of them and use for example ” as 3rd column . then you can use
UnionandOrderby to achieve you final query.(because I didn’t know your tables structures I just used A.,b.,C.*)