Been at this for a while and getting no where.
Code:
(
SELECT fc.cause_id, fc.type_id, c.likes, fc.params, fc.activity_date, c.name, c.permalink
FROM (SA_feeds_causes fc)
JOIN SA_causes_followers cf ON cf.cause_id = fc.cause_id AND cf.angel_id = 3
JOIN SA_causes c ON c.id = fc.cause_id
)
UNION
(
SELECT ff.angel_id, ff.cause_id, ff.type_id, ff.params, ff.activity_date, c.name, c.permalink
FROM (SA_feeds_friends ff)
JOIN SA_angels_friends af ON af.friend_id = ff.angel_id AND af.angel_id = 3 AND af.state = "active"
JOIN SA_causes c ON c.id = ff.cause_id
)
ORDER BY
activity_date desc
Separately the query's get what I expect but in a UNION I get:
Quote:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
'JOIN SA_angels_friends af ON af.friend_id = ff.angel_id AND af.angel_id = 3 AND ' at line 1
|
I've read that the number of cols need to match so added in one I don't really need, didn't fix.
Open to better ideas than union to do the same job too. I have a third table to add, not up to that yet however.