数据库中,一张表里面有房间号和老师号,比如:
答案:3 悬赏:80 手机版
解决时间 2021-11-24 06:11
- 提问者网友:疯子也有疯子的情调
- 2021-11-23 05:49
数据库中,一张表里面有房间号和老师号,比如:
最佳答案
- 五星知识达人网友:由着我着迷
- 2021-11-23 07:26
追问
我是想用查询语句得到一个这样的表
追答SELECt roomID,CONCAt(teacher SEPARATOR',') teacher FROM teacher where roomID = ?
你去试试追问
我是想用查询语句得到一个这样的表
追答SELECt roomID,CONCAt(teacher SEPARATOR',') teacher FROM teacher where roomID = ?
你去试试追问
全部回答
- 1楼网友:空山清雨
- 2021-11-23 08:44
INSERT into teacher(roomID, teacher)
VALUES(1, '李老师,张老师');
首先roomID是整形的,不应该带单引号,其次insert into 而不是insert
VALUES(1, '李老师,张老师');
首先roomID是整形的,不应该带单引号,其次insert into 而不是insert
- 2楼网友:独钓一江月
- 2021-11-23 07:38
Oracle
select roomID, wm_concat(teacher) teacher
from teacher
group by roomID
Sql Server
select roomID, (stuff((select ',' + teacher from teacher b where b.roomID=a.roomID for xml path('')),1,1,'')) teacher
from teacher a
group by roomID追问mysql能实现吗?
select roomID, wm_concat(teacher) teacher
from teacher
group by roomID
Sql Server
select roomID, (stuff((select ',' + teacher from teacher b where b.roomID=a.roomID for xml path('')),1,1,'')) teacher
from teacher a
group by roomID追问mysql能实现吗?
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯