Skip to main content
All Problems
medium0% acceptance

All Medications per Patient (Comma-Separated)

The pharmacy wants a compact view of all medications each patient takes. Use GROUP_CONCAT to list all distinct medications per patient. Return patient full name (first_name || ' ' || last_name) as patient_name and medications. Order by patient last name. Use a subquery to get distinct medications before concatenating.

Schema

🔑idINT
first_nameTEXT
last_nameTEXT
date_of_birthTEXT
genderTEXT
emailTEXT
phoneTEXTNULL
blood_typeTEXT
cityTEXT
stateTEXT
🔗insurance_idINTNULL
created_atTIMESTAMP
postgresql

Run your query to see results

Press Ctrl + Enter to execute