I have the SQL below. In addition to the count of records that match in deprec, deprec has an ID column. I want a list of all IDs for the records that match, returned in one text column, like '123', '456', '666'). How can I do this? Using a View? A stored proc?
SELECT temp.id, name, description, (SELECT COUNT(*) FROM deprec where cal_template_id = temp.id) as count
FROM calibration_template temp