ID, NAME, JOB
1, john, teacher
2, doe, farmer
3, obama, farmer
4, sweden, teacher
我可以使用什么语法来打印具有例如教师值形式JOB列的行?所以输出是这样的:
1, john, teacher
4, sweden,teacher
提前致谢! :)
答案 0 :(得分:2)
只做一个条件
SELECT * FROM information WHERE job = 'teacher';
然后你会得到输出
ID |NAME |JOB
---|-------|------
1 |john |teacher
4 |sweden |teacher
答案 1 :(得分:1)
SELECT * FROM information WHERE JOB = 'teacher'
答案 2 :(得分:0)
尝试输出为字符串:
SELECT CONCAT_WS(',', ID, NAME, JOB) WHERE JOB='teacher'