[thelist] can / should this be done in SQL?
Joel D Canfield
Joel at BizBa6.com
Thu Jul 9 02:09:54 CDT 2009
> select * from (
> SELECT * FROM news WHERE category = 1 LIMIT 4
> UNION
> SELECT * FROM news WHERE category = 2 LIMIT 3
> UNION
> SELECT * FROM news WHERE category = 6 LIMIT 3
> UNION
> SELECT * FROM news WHERE category = 3 LIMIT 2
> ) order by date desc
doesn't that just sort the results, returning whichever records happen
to come first in each category?
joel
More information about the thelist
mailing list