Re: Crosstab in Mysql

2005-04-25 Thread Alvaro Cobo
!. - Original Message - From: Peter Brawley To: Alvaro Cobo Cc: mysql@lists.mysql.com Sent: Monday, April 25, 2005 11:02 PM Subject: Re: Crosstab in Mysql Alvaro, I suspect the error message refers to the subquery missing a non-aggregate column on which to GROUP BY. I may

Re: Crosstab in Mysql

2005-04-25 Thread Peter Brawley
Alvaro, I suspect the error message refers to the subquery missing a non-aggregate column on which to GROUP BY. I may misunderstand your query--I'm not clear why you can't just write ... SELECT   f.PK_partic,   f.FK_IS,   f.OB_familia,   Sum( IF( insumo_or = "Animal1", cantidad_or, 0 ))

RE: Crosstab in Mysql

2005-04-25 Thread mathias fatene
Hi, What do you obtain with : Select FK_partic, Sum(IF(insumo_or = "Animal1", cantidad_or, 0) ) AS "Animal1", Sum(IF (insumo_or = "Animal2", cantidad_or, 0) ) AS "Animal2", Sum(IF (insumo_or = "Animal3", cantidad_or, 0) ) AS "Animal3", Sum(IF (insumo_or = "Animal4", cantidad_or, 0) ) AS "Animal4