A
Size: a a a
A
БГ
select m.id, u.name, case when u.id = m.to_id then "TO" else "FROM" end as "direction", m.text from messages m join users u on u.id = m.to_id or u.id = m.from_id where m.to_id = ? or m.from_id = ? order by id desc
A
БГ
A
A
БГ
БГ
A
A
БГ
БГ
A
A
БГ
A
A
БГ
БГ
select m.id, u.name, case when u.id = m.to_id then "TO" else "FROM" end as "direction", m.text from messages m join users u on u.id = m.to_id or u.id = m.from_id where m.to_id = ? or m.from_id = ? order by id desc