postgresql - Interleaving the rows of two different SQL tables, sorting by date -


in postgres i've got 2 different tables have nothing in common, save fact both have creation date. i'd use creation date in order display instances of both of models on timeline. that, imagine need first somehow select of created_at timestamps both of tables in 1 statement, sort them in descending order, paginate resulting set, , go through , detect model each of rows corresponds in order display data.

any idea if possible?

maybe smth this

select created_at, 'a' tab_name table_a  union select created_at, 'b' tab_name table_b order created_at 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -