Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- communications.creation_date as message_date,
- message as message_text,
- employees.first_name || ' ' || coalesce(employees.middle_name,'') || ' ' || employees.last_name as message_by
- FROM app.communications
- INNER JOIN app.employees ON communications.message_from = employees.emp_id
- WHERE send_as_sms = TRUE AND com_id = (SELECT MAX(com_id) FROM app.communications)
- SELECT
- cs.com_id,
- cs.first_name ||' ' || cs.last_name AS recipient_name,
- cs.sim_number AS phone_number
- FROM app.communication_sms cs
- WHERE cs.com_id = (SELECT MAX(cs2.com_id) FROM app.communication_sms cs2)
- ORDER BY first_name ASC
Add Comment
Please, Sign In to add comment