On Tue, 2002-12-31 at 14:53, Steve Vernon wrote:
> Hiya,
>     I have a database about projects in a company, they all have a start
> year and end year. If the projects have not ended then they get a end year
> of 0000. I have made a SQL command, given a year, works out with projects
> are running in that year.
> 
>     The company I am doing this for, wants basically a drop down box which
> says (1950- 8 Projects) and such like. Now with the current command I have
> it would mean 92or so SQL commands as the company has records back to 1910.
> 
>     Is there a way to do this in one command? I have searched all the
> mannual and I can work out something similair to a for loop in SQL. Would
> variables help?
> 

Hi Steve,

You want to use "select .... group by", something like:

select start_year, count(*) from projects group by start_year;


==
Martin


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to