Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. select distinct agent, count(customer) as total_customer,
  2. (select count(january_1) from salestable where january_1!=0 group by agent) as sales_customer
  3. from salestable
  4. where customer_type = "urban"
  5. group by agent
  6. order by agent asc
  7.  
  8. more than one row returned by a subquery used as an expression
  9.  
  10. more than one row returned by a subquery used as an expression
  11.  
  12. select agent,
  13. count(customer) as total_customer,
  14. count(case when january_1 <> 0 then 1 end) as sales_customer
  15. from salestable
  16. where customer_type = "urban"
  17. group by agent
  18. order by agent asc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement