You are here: Re: Help with SQL Statement to find first and last populated field in string of fields « MsSQL Server « IT news, forums, messages
Re: Help with SQL Statement to find first and last populated field in string of fields

Posted by Alex on 06/22/06 13:15

Erland Sommarskog wrote:
>
> For the example table, this should work:
>
> SELECT Number, first, last, difference = first - last
> FROM (SELECT Number,
> first = coalesce(Jan, Feb, Mar, Apr, May, Jun),
> last = coalesce(Jun, May, Apr, Mar, feb, Jan)
> FROM tbl) as s
>
>

That's exactly what I'm looking for! I didn't know this function
existed, even after reading through several books and online resources.
Thanks :)

Alex

 

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

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