欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mysql sql查询时 if 的用法 MySQLSQLPHPUnixBlog 

程序员文章站 2024-02-07 19:46:28
...
SELECT qanswers.id,qanswers.question_id,qanswers.answer,users.nickname AS replier,

users.groupname,IF(users.groupname='teacher',TRUE,FALSE) AS isTeacher

FROM fa_user_question_answer AS qanswers 

LEFT JOIN fa_users AS users ON users.id=qanswers.user_id 

WHERE qanswers.question_id=11