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)
How to write the SQL Querry to check who is the customers not active based on status?
CodePudding user response:
SELECT *
FROM customerDB
JOIN mobileDB ON custumerDB.customerID = mobileDB.custumerID
WHERE status IS NOT NULL
CodePudding user response:
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)