Reputation: 2000
Can someone please help me in this minute error. I wrote this, (which is not working),
SELECT sum(case when SD.order_id>0 then 1 else 0 end) as SD.customer_id
FROM tbl_order_lead_send_detail SD
but, this query is working fine.
SELECT sum(case when order_id>0 then 1 else 0 end) as customer_id
FROM tbl_order_lead_send_detail
Upvotes: 0
Views: 27
Reputation: 1346
Please try:
SELECT sum(case when SD.order_id>0 then 1 else 0 end) as customer_id FROM tbl_order_lead_send_detail, SD
Upvotes: 1
Reputation: 31249
You problem is this:
as SD.customer_id
You might consider writing:
as `SD.customer_id`
EDIT
Becuase you cannot have .
in the column names. If you have them as a string it works. The .
is used for columns in tables.
Upvotes: 2