[thelist] mysql select query

Martin Kuplens-Ewart martin at takingitglobal.org
Thu Apr 4 08:42:02 CST 2002

SELECT * FROM $db.$table WHERE ((SectionID = $SectionID AND Live = 1) OR
(Section ID = $SectionID2 AND Live = 1)) AND Published = 1 ORDER BY

[I assume you've got something like a SectionID defined...]
[Also assuming that you have a checkboks or whatever for liveness... If
it's a status, I'm sure you'll know how to modify.]
[If you find yourself getting dupe articles... Try replacing the * with
'DISTINCT ContentID [or whatever the unique ID is.]



-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org] On Behalf Of kris burford
Sent: April 4, 2002 9:30 AM
To: thelist at lists.evolt.org
Subject: [thelist] mysql select query

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.


For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !

More information about the thelist mailing list