Subject [ib-support] GROUP BY and JOINS - How to?
Author Gustavo D. B.
Hi...

I'm porting an MySQL app to Firebird 1.5...

I was trying to "translate" a very complex query and I got an error, so I
simplified the error an I get this query to be the simpler erroneous one...

When doing something like this I get an error message...

SELECT
products.idproduct,
products.name,
SUM(batchs.stockl)
FROM
products LEFT JOIN batchs ON batchs.idproduct=product.idproduct
GROUP BY products.idproduct

When I run this select I get a "Invalid token. Dynamic SQL Error. SQL error
code = -104. invalid column reference.".

I've tried everything... I've tried to GROUP by batchs.idproducts (including
this column in the select) but getting the same result...

SUM() and GROUP works fine without when used in single table selects without
JOINs, and the JOINs work fine without the SUM() and the GROUP by...

I'm sure I'm doing somethin wrong here, because this kind of opperantions
are very frecuent... Sorry by my english...

Any hint?... TIA... Gustavo...