Skip to content
Advertisement

Can I use Where Clause like this for my query.. help me [closed]

SELECT DATE(dateissued) AS date
     , SUM(amount) AS total_collection1 
 Where accountcodeid = '44'
     , SUM(amount) AS total_collection2   
 Where accountcodeid = '40'
  FROM payment
 GROUP 
    BY dateissued 
 ORDER 
    BY dateissued DESC 
 LIMIT 10

Advertisement

Answer

No but

SUM(case when accountcodeid = '44' then amount else 0 end) AS total_collection1

is valid

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement