简体   繁体   English

MYSQL - 仅选择状态未更改的行

[英]MYSQL - Select only rows with status not changed

please i need help in this Topic :请我在这个主题上需要帮助:

i have a table with multiple rows having multiple status like this enter image description here我有一个多行的表,有多个状态,像这样在此处输入图像描述

but i want to get only rows where the status equal status="NA" for all lead_id : like this : the same lead_id / phone_number / status但我只想获取状态等于 status="NA" 的所有 Lead_id 的行:像这样:相同的 Lead_id / phone_number / status

The same lead_id / and phone_number but status usualy equals to "NA"相同的lead_id / 和phone_number 但状态通常等于“NA”

You just need a WHERE clause:你只需要一个 WHERE 子句:

SELECT lead_id, status, phonenumber
FROM t
WHERE status = 'NA'

Replace t with the name of your table.将 t 替换为您的表的名称。

that it thnx for all reply它感谢所有回复

SELECT lead_id as id,COUNT( lead_id ) AS TOTAL FROM vicidial_log GROUP BY lead_id HAVING TOTAL =(SELECT COUNT(lead_id) FROM vicidial_log WHERE status ='NA' AND lead_id=id) SELECT Lead_id 作为 id,COUNT( lead_id ) AS TOTAL FROM vicidial_log GROUP BY Lead_id HAVING TOTAL =(SELECT COUNT(lead_id) FROM vicidial_log WHERE status ='NA' AND Lead_id=id)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM