Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- group_id integer REFERENCES <some other table>
- item_id integer REFERECNES <some other table>
- timestamp date
- data text
- sort_order text
- SELECT DISTINCT ON (item_id)
- data
- FROM [this table]
- WHERE group_id = [some value]
- AND timestamp < [some value]
- ORDER BY item_id, timestamp DESC
Add Comment
Please, Sign In to add comment