我首先要查詢用戶所屬的部門select deptId from employee where id='00'結果為:“12,33,25”deptId字段存放的是varchar類型,多個部門id用逗號隔開的我現在要根據上面的部門編號一下查出所有的部門記錄,就像下面的這樣的語句的結果select * from dept where id in ('12','33','25')我現在是這樣寫的:select * from dept where id in (select deptId from employee where id='00')上面的語句不行,請問要實現這樣的結果,怎么用sql語句一下就實現這樣的功能?
添加回答
舉報
0/150
提交
取消