Subject Column unknown
Author Jose Gomez
Hi, I'm having a wierd problem.

I have an IBOQuery that when I open it I get the "Column unknown
TOTAL_FALTANTE" error, if I prepare the query first I do get the error, but
then I can open it with no problems.

A partial fix is that I trapped this error with:
try
Query.prepare;
except
end;
Query.ParamByName(...)
Query.Open;

Here's the SQL:
SELECT Pedidos.Pedido , Pedidos.Cliente , PedidosD.Producto,

sum( PedidosD.Cantidad ) as Total_Solicitado ,
um( PedidosD.Cantidad_Surtida ) as Total_Surtido ,

sum( ( PedidosD.Cantidad - PedidosD.Cantidad_Surtida ) ) as Total_Faltante

FROM Pedidos INNER JOIN PedidosD ON ( Pedidos.Pedido = PedidosD.Pedido )

WHERE (( Pedidos.Cancelada ='F' ) AND ( Pedidos.Cliente LIKE :Cliente ) AND
( PedidosD.Producto LIKE :Producto ) AND

(( Pedidos.Fecha_Requerida_Entrega BETWEEN :FIni AND :FFin ) OR
Pedidos.Fecha_Requerida_Entrega IS NULL )))

GROUP BY Pedidos.Pedido, Pedidos.Cliente , PedidosD.Producto;