You are here: help with a query « MsSQL Server « IT news, forums, messages
help with a query

Posted by Sam on 02/27/07 17:04

Hi,

I have one table like :

MyTable {field1, field2, startdate, enddate}

I want to have the count of field1 between startdate and enddate, and
the count of field2 where field2 = 1 between startdate and enddate,
all in the same query.

I know how to get the first part (see below), but i don't know how to
include the count of field2 where field2 = 1 in each row.

select count(field1) as field1
from MyTable
where startdate >= '01-24-2007' and enddate <= '02-25-2007' and field2
= 0
group by field1


Can you help ?
thanks

 

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

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