SELECT c.name as "Client Name"
, c.email as "Email"
, c.phone as "Phone"
, cnt.name as "Country"
, c.street as "Street"
, c.city_id as "City/Suburb"
, st.name as "State"
, c.zip_code as "Postcode"
, "" as "Total Paid"
, "" as "Total Owed"
, CASE WHEN c.delete_status = 1 THEN "Not Active" ELSE "Active" END as "Status"
FROM customer c
LEFT
JOIN shipping_address s
ON c.id = s.customer_id
LEFT
JOIN states st
ON st.id = c.state_id
LEFT
JOIN countries cnt
ON cnt.id = c.country_id
WHEN c.delete_status = 0
Above is my query. And I am having below error message in phpmyadmin where i am not finding any issue in query.
2
Answers
Change WHEN to WHERE in the query
You have some issue the error message is related to wrong clause word
USE where (and not when ) for where condition
but you have also a wrong use of quote
don’t use double quote for column name alias use backtics when needed