Re: Need to scan MySQL table

From: Date: Mon, 06 Nov 2000 09:22:36 +0000
Subject: Re: Need to scan MySQL table
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-23862@lists.php.net to get a copy of this message
In article <4a1891a551nik@cheddarcheese.de>, Nik Gare <nik@cheddarcheese.de> wrote: > In article <20001105011519.A57285@psynix.com>, John Meredith > <johnm@psynix.com> wrote: > > 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; > Helps perfectly :-) Just one more quick question... This query gives me > the correct listing, ie: April 2000 June 2000 August 2000 April 2001 > What would be really good is to end up with something like this HTML > for each line: <a href="foo.php?2000-04">April 2000</a> If anyone is interested (probably not ;-)) I managed to do it the following way: $result = mysql_db_query("Maidenhead_MS","SELECT DISTINCTROW(DATE_FORMAT(date, \"%Y %m %M\")) AS MonthYear FROM MS_data WHERE type = \"dates for your diaries\" GROUP BY date;",$crl_link); which got me the data that I wanted, and then using split() I got the right parts in the right order. Many thanks for the help, Nik

« previous php.general (#23862) next »