php - MySql 算子复杂度

标签 php mysql

我有一个关于表的反馈系统的宠物项目,一个捕获客户的问题,另一个捕获服务台的答案。


////////////////////////////////////////////////////////////////////////
Customers_Question table         AND   helpdesk_answers  includes: 
Qst_id(pk),                            Qst_id(pk)(FK)
qst_title,                             helpdesk_answer
qst_comment,
qst_customer_name, 
qst_date

得到mysql查询的答案是:

SELECT*from customers_question, helpdesk_answers
WHERE customers_qst.Qst_id = helpdesk_answers(FK Qst_id)

我得到了所有已经回答的问题。 问题:如何获取或统计未回答的问题?

最佳答案

SELECT q.* 
from customers_question q
left join helpdesk_answers a on q.Qst_id = a.Qst_id
where a.Qst_id is null

参见 this great explanation of joins

关于php - MySql 算子复杂度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24591715/

相关文章:

mysql - 基于三个关系表连接一个报表

MySQL db - 我可以在字段内使用通配符吗?

mysql - Apache2 无缘无故地给出 403 Forbidden

PHP mail() - 如何设置优先级?

php - SimpleXML 根节点前缀 php

javascript - CodeIgniter AJAX文件上传,上传时$_FILE为空

php - 表 [tablename] 未锁定

php - mac 上的 XAMPP 安装问题//bitnami-first-boot-123456

php - 如何判断一个MIME类型是JPG、PNG、BMP还是GIF?

php - htaccess 重写 - 文件名无法识别