List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:November 8 2013 11:23am
Subject:Re: Mysql 5.1 union with group by for results
View as plain text  
----- Original Message -----
> From: "Machiel Richards" <machiel.richards@stripped>
> 
> ERROR 1064 (42000): 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 'GROUP BY t.AccountID,


I suspect your query has never been doing what you think at all, and you need to 


  select [fields] from (
    select fields1 blahblah
    UNION
    select fields2 blahblah) unionized
  group by blurb


that is, wrap the entire union in a virtual table and do the group by on that.


-- 
Unhappiness is discouraged and will be corrected with kitten pictures.
Thread
Mysql 5.1 union with group by for resultsMachiel Richards8 Nov
  • Re: Mysql 5.1 union with group by for resultsJesper Wisborg Krogh8 Nov
    • Re: Mysql 5.1 union with group by for resultsMachiel Richards8 Nov
Re: Mysql 5.1 union with group by for resultsJohan De Meersman8 Nov
  • Re: Mysql 5.1 union with group by for resultsMachiel Richards8 Nov