Re: Most Read Article

From: Date: Mon, 05 Nov 2001 15:23:02 +0000
Subject: Re: Most Read Article
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-14015@lists.php.net to get a copy of this message
Thanks, works a treat. How database intensive would this be if I had a lot of records in a table? Cheers, Jord On Monday 05 November 2001 09:47, you wrote: > try this... > > SELECT title,reads FROM articles ORDER BY reads DESC LIMIT 1; > > That should do the trick.. (in mySQL or PostgreSQL anyway) > > -- > Shane > > On Monday 05 November 2001 9:36 am, you wrote: > > Hi, > > I'm trying to get the most read article out a table. > > The table has a title column, a read column and some others. > > > > So I wanna SELECT the title from the table and the most read figure. > > I tried: > > > > SELECT title, MAX(reads) FROM articles > > > > This only gets the second most read article?! If I take out the title > > like: > > > > SELECT MAX(reads) FROM articles > > > > Then it gets the top article number but obviously not the title. > > > > Can anyone shed some light? > > > > Cheers, > > Jord -- Jordan Elver Web Developer The InternetOne UK Ltd

« previous php.db (#14015) next »