Guest User

Untitled

a guest
May 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. group_id integer REFERENCES <some other table>
  2. item_id integer REFERECNES <some other table>
  3. timestamp date
  4. data text
  5. sort_order text
  6.  
  7. SELECT DISTINCT ON (item_id)
  8. data
  9. FROM [this table]
  10. WHERE group_id = [some value]
  11. AND timestamp < [some value]
  12. ORDER BY item_id, timestamp DESC
Add Comment
Please, Sign In to add comment