You are here: Re: Help!? Combining SQL Queries? Can it be done?? « MsSQL Server « IT news, forums, messages
Re: Help!? Combining SQL Queries? Can it be done??

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация