|  | Posted by Ed Murphy on 12/18/06 16:38 
markc600@hotmail.com wrote:
 > select date,
 >        user,
 >        sum(case when transaction_type ='debit' then amount else 0 end)
 > /
 >        sum(amount) as perc_Debit
 > from mytable
 > group by date, user
 
 You're right, I guess coalesce() isn't needed.  (It would have been
 needed in the temp-tables approach, if you wanted to pick up date/user
 combinations with 0% debits.)
  Navigation: [Reply to this message] |