Re: Need to scan MySQL table

From: Date: Sat, 04 Nov 2000 14:45:19 +0000
Subject: Re: Need to scan MySQL table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-23715@lists.php.net to get a copy of this message
Hi, Off the top of my head, a query like the following should do it for you: SELECT DISTINCTROW(DATE_FORMAT(SomeDate, "%M %Y")) AS MonthYear FROM SomeTable GROUP BY SomeDate; where 'SomeDate' is your date field in the table. Then all you need to do is build up your menu from the result set returned. Hope that helps. Regards, John On Sat, Nov 04, 2000 at 02:19:51PM +0100, Nik Gare wrote: > Hi, > I'm not too sure if this shoul be sent here or the MySQL mail list, so > just let me know... > > I have data in a MySQL table in the following form: > > type date details > > report 2000-04-09 some details here > report 2001-06-16 some other details here > report 2000-04-16 some different details here > [lots more data with different dates] > > What I would like to do is to make a menu out of just the dates, ie end > up with: > > April 2000 > June 2001 > ... > > as links in the HTML. > > I can probably suss out how to change the dates from 2000-04-09 to April > 2000, but can not work out how to scan the dates field and just end up > with one occurence of each date. > > I hope this makes sense, > Nik

« previous php.general (#23715) next »