So I currently have an sql statement:
Select room_no, category from help_desk where room_no = '133' OR room_no = '120';
and it returns:
How would I write an sql statement that would return it like this
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityYou need to use three things
Here is such a query
Select room_no, group_concat(distinct category) categories
from help_desk where room_no in (133,120) group by room_no;
You are looking for the group_concat feature.
For example:
SELECT room_no, GROUP_CONCAT(category)
FROM help_desk
GROUP BY room_no;