Hi, I posted the following code in one or two of my earlier posts and _then_ it WAS working! I know there is no GROUP BY clause but IT WAS WORKING somehow - the procedure ran fine and inserted quite a good few records. However, NOW, after I have dropped and re-created the database/tables/all the stuff, MySQL is complaining that I should put a GROUP BY in the following procedure:
create procedure PersonAdd ( Ttl_ char(15), frstNm_ varchar(15), midNm_ varchar(15), lstNm_ varchar(15), Gender_ char(1), dob_ char(8), /* yyyymmdd */ nicNo_ varchar(13), mrtlStts_ char(1), cellNo_ varchar(15), website_ varchar(80), machine_no_ int) begin insert into Person (PersonID, Ttl, frstNm, midNm, lstNm, Gender, dob, nicNo, mrtlStts, cellNo, website) select (machine_no_ * 1000000) + (CASE WHEN ((max(PersonID)) - ((max(PersonID) div 1000000) * 1000000)) is null Then 0 ELSE ((max(PersonID)) - ((max(PersonID) div 1000000) * 1000000)) END) + 1 as PersonID, Ttl_, frstNm_, midNm_, lstNm_, Gender_, dob_, nicNo_, mrtlStts_, cellNo_, website_ from Person; end; When I put all of the fields (except the first expression containing the aggregage functions) in the group by clause, MySQL complains that I didn't put PersonID in the GroupBY clause and when I do put PersonID in the GROUP BY clause MySQL still complains. I didn't change anything in the code or anything - just re-created the database, tables, etc. Any help as to what is causing this strange behavior and why it did work previously? -- Thanks in advance, Asif -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]