[thelist] mysql select query

Means, Eric D eric.d.means at boeing.com
Thu Apr 4 08:40:00 CST 2002


> 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.
>

select * from stories
where published is not null
and (storytype not in ('news', 'feature') or live is not null)
order by random limit 3

Should work, not tested.



More information about the thelist mailing list