Ailsom F. Heringer (Osklen) wrote: > But CASE do not work with "< 0" . > > This is OK (0 is summed as it was 1): > SELECT SUM(CASE DISCOUNT WHEN 0 THEN 1 ELSE 0 END) from table > > But this one doesn´t work: > SELECT SUM(CASE DISCOUNT WHEN < 0 THEN DISCOUNT ELSE 0 END) from table
Do it this way: select sum(case when discount<0 then discount else 0 end) from table. HTH Saludos, Jaime Vasquez Guatemala C.A. _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.