[thelist] mysql select query

kris burford [midtempo] kris at midtempo.net
Thu Apr 4 08:32:00 CST 2002

sorry, me again.

trying to wrestle with sql statement and was hoping for some pointers. i've
a table containing story articles and their relevant story sections which
can be published/unpublished _and_ live/archived. am trying to select a
limited number of random stories that are published and, if they're from
particular sections, only live.

so basically i've need a statement that does:

select stuff from stories where published is not null and, if its a news
story or a feature story, make sure live is not null, order by random limit 3

it's the "if it's a news story..." bit that i'm stumped on.

any help *really* appreciated.



More information about the thelist mailing list