[英]How to display multiple row values in musql table in a single html table row
I have database table like this 我有这样的数据库表
Treatment_ID Drugname
1 panadol
1 piriton
1 Parasitamo
I want to display this information in a html table as follows 我想在html表中显示此信息,如下所示
treatmentid drugname
1 panadol,piriton,Parasitamo
How I can display as above html table? 我怎样才能显示如上的html表?
You can do it using group_concat like this 您可以像这样使用group_concat来做到这一点
SELECT Treatment_ID as treatmentid, group_concat(Drugname SEPARATOR ',' ) AS drugname
FROM tablename GROUP BY Treatment_ID
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.