[英]List all the customers who are not active, with MySQL
I have complicated questions that need your help:我有复杂的问题需要你的帮助:
Q: List all the customers who are not active.问:列出所有不活跃的客户。
Customer db: customerid, name, address.... mobile db: customer id, mobileid, status ( Null and Cancelled date)客户数据库:客户 ID、姓名、地址.... 移动数据库:客户 ID、移动 ID、状态(空和取消日期)
How to write the SQL Querry to check who is the customers not active based on status?如何编写 SQL 查询来根据状态检查谁是未活跃的客户?
SELECT *
FROM customerDB
JOIN mobileDB ON custumerDB.customerID = mobileDB.custumerID
WHERE status IS NOT NULL
SELECT *
FROM Customer as c
JOIN Mobile as m on m.customer_id = c.customer_id
WHERE m.status is not Null
You can further expand this query to include other values:您可以进一步扩展此查询以包含其他值:
SELECT *
FROM Customer as c
JOIN Mobile as m on m.customer_id = c.customer_id
WHERE 1=1
and m.status is not Null
and c.name = 'john'
and c.mobileid in (293478, 2834783, 282383, 672723)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.