You are here: Re: Query Question « MsSQL Server « IT news, forums, messages
Re: Query Question

Posted by ZeldorBlat on 01/22/08 16:46

On Jan 22, 9:49 am, wackyph...@yahoo.com wrote:
> Is it possibe to combine the results of these 2 queries into a single
> result set consisting of 1 row and 2 columns (for each value)?
>
> SELECT COUNT(*) AS 'SlnCount' FROM Request WHERE RequestTypeID = 2
> SELECT COUNT(*) AS 'NewSlnCount' FROM Request WHERE RequestTypeID = 2
> AND StatusID = 1

SELECT COUNT(*) AS 'SlnCount',
SUM(CASE WHEN StatusID = 1 THEN 1 ELSE 0 END) AS 'NewSlnCount'
FROM Request
WHERE RequestTypeID = 2

 

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

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