9
I tried to do this internal merge in SQL to connect two tables in my report.
What I’d be doing wrong, why is giving "ffccf column unknown", even though I nicknamed the column?
Follows the code:
SELECT finafim.ccf as ffccf, finafim.impcaixa, finafim.numcup, finafim.vlfina, finafim.descfina,
tabc470.ccf as t4ccf, tabc470.NSerie, tabc470.numcupom
FROM finafim
INNER JOIN tabc470
ON (finafim.numcup = tabc470.numcupom)
AND (finafim.ccf = tabc470.ccf)
AND (finafim.impcaixa = tabc470.NSerie)
WHERE ffccf= :ppccf AND numcup= :ppcoo AND impcaixa= :ppecf //Detalhes de parâmetros para igualar valores.
AND dtcomp BETWEEN "2014/03/01" AND "2014/05/01"
Count, sum, avg also
– Enzo Tiezzi
@Enzotiezzi can give
apelidos
the results of the aggregation functions, but cannot reference columns by theirapelidos
within the functions.– Omni
but if you from a select Count(table), you will need to nickname to be able to withdraw the value, in case it is valid then also.
– Enzo Tiezzi
@Enzotiezzi doesn’t need to name the
count(...)
to remove the value (in this case the result would appear Count(...)) (sqlfiddle)– Omni