Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select d.id, dc.sum, dc.calc_date
- from debt d
- inner join (
- select dc.parent_id, dc.sum, dc.calc_date
- from debt_calc dc
- where dc.id in (
- select max(id)
- from debt_calc
- group by parent_id
- )
- ) dc on dc.parent_id = d.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement