Re: Query qizzle quackarooney! :|

From: Date: Tue, 13 Feb 2001 11:08:33 +0000
Subject: Re: Query qizzle quackarooney! :|
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6568@lists.php.net to get a copy of this message
On 13 Feb 2001, at 11:41, Trond Erling Hundal wrote: > Hey there fellow querieres.... > I summon your power! (eh..) > > well.. enough with the nonsense :) > > I have a littlebit of problem: > > I am displaying 15 different newsarticles on a page. > The articles are displayed in three different tables. > > First there`s one article (the main-top-story) that is shown in the top of > the page. > Then there is an ad. > And then. Below this ad, there are two columns, each displaying 7 articles > each. > > The articles can be divided into two distinct groups. > smallnews, and news, and this is stored in the article table in a field > named Kategory! > > That is: smallnes cannot be shown before 4 "real" newsarticles has been > displayed. > > What do YOU think? > Divide your query in two part. Supposing you're ordering them by freshness, something like: "select * from news where Kategory=bignew order by date desc limit 4" and "select * from news where Kategory=smallnew order by date desc limit 3" likewise, do 2 cicles, the first showing major news, the second showing small ones. This way you don't need a single "if" nor complicated flow control structure... I've always liked KISS predicate :-) HTH, bye /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Fabrizio Ermini Alternate E-mail: C.so Umberto, 7 faermini@tin.it loc. Meleto Valdarno Mail on GSM: (keep it short!) 52020 Cavriglia (AR) faermini@sms.tin.it

« previous php.db (#6568) next »