I have a column in my SQLite database table (fldSuit) which stores the codes of a list of limitations in a single string. These codes each have a description in a separate table (fldAtts). Example below:
fldsSuit
fld_id fld_limits
1 HR, HST
fldAtts
fld_att_code fld_att_desc
HCA Hindrance - Canals
HR Hindrance - Row Width
HST Hindrance - Stones
How do i query the database to look like:
Desired Output
Field Limitations
1 Hindrance - Row Width, Hindrance - Stones
Hope you can help me.
EDIT: Put the actual names above and tried the solution by Tim below:
SELECT
f.fld_id,
group_concat(a.fld_att_desc) as Limitations
FROM fldsSuit f
LEFT JOIN fldAtts a
ON ',' || REPLACE(Limitations, ' ', '') || ',' LIKE
'%,' || a.fld_att_code || ',%'
GROUP BY
f.fld_id;