I'm getting an error on a statement that tries to use ORDER BY with an IF(x>y,y,x) statement. Is there some other way to do this?
Here's the actual situation and the script I've tried if it helps...
Situation: Each row is an entry pulled from several RSS feeds and if someone is future dating their posts I want to substitute in the 'added' timestamp instead of the 'published' timestamp whenever the published date is greater than the added timestamp.
SELECT e.cid, e.id, e.url, e.title, SUBSTRING( e.description, 1, 250 ), IFNULL(e.pubdate, e.added), f.siteurl, f.title, IF ( length( e.description ) =0, '', concat( substring( e.description, 1, 75 ) , '...' ) ) FROM feeds_item e INNER JOIN feeds_channels f ON (e.cid = f.id) ORDER BY IF(e.pubdate>e.added,e.added,e.pubdate) DESC LIMIT 100">