ianh Posted March 22, 2010 Share Posted March 22, 2010 Hi, I am trying to perform a union join query but it is producing an error and really not sure why. I think it has something to do with status being -1 but not sure. Should negative values be treated differently? SELECT title, abstract, body, status, right_column FROM Articles WHERE category_id = 2 AND id = 3062 AND status = -1) UNION (SELECT title, abstract, body, status, right_column FROM Articles WHERE category_id = 2 AND id > 3062 AND status = '-1' AND right_column = "1" ORDER BY id ASC LIMIT 1) ORDER BY right_column ASC gives error: #1064 - 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 ') UNION (SELECT title, abstract, body, status, right_column FROM Articles WHERE ' at line 1 Any help is much appreciated. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/196084-union-join-query-with-negative-values-please-help/ Share on other sites More sharing options...
kickstart Posted March 22, 2010 Share Posted March 22, 2010 Hi You have a bracket missing or an extra bracket. At the end of the first select you have a close bracket but there is no open bracket prior to that. All the best Keith Link to comment https://forums.phpfreaks.com/topic/196084-union-join-query-with-negative-values-please-help/#findComment-1029911 Share on other sites More sharing options...
ianh Posted March 26, 2010 Author Share Posted March 26, 2010 Many thanks mate. Can't believe I missed out the bracket Link to comment https://forums.phpfreaks.com/topic/196084-union-join-query-with-negative-values-please-help/#findComment-1032232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.