示例表结构:
create table issues
(id int, title varchar(50), affectedclients varchar(max))
create table clients
(id int, name varchar(50))
insert into issues (id, title, affectedclients) values (1, 'Error when clicking save', '["1","2"]');
insert into issues (id, title, affectedclients) values (2, '404 error on url', '[3]');
insert into clients (id, name) values (1, 'Tesco');
insert into clients (id, name) values (2, 'Costa');
insert into clients (id, name) values (3, 'Boots');
insert into clients (id, name) values (4, 'Nandos');
我想运行一个查询,以便我可以获取以下格式的数据:
Id Title AffectedClients 1 Error when clicking save Tesco, Costa 2 404 error on url Boots
我怎样才能以最高效的方式实现这一点?
如果使用正确规范化的数据库很容易做到这一点,那么请提供一个示例。