Good afternoon, I have the following select
:
select codemp, codfunc, codevento
, vlrevento
from sankhya.TFPFOL
where codemp = 1
and codfunc = 26
and month(referencia) = 1
and year(referencia) = 2009
group by codemp, codfunc, codevento
, vlrevento
having count(1)=1
That shows me the result below
Noticethatthereare2fieldswithcodevento
534.Iwanttoremovebothbutkeepvlrevento
totheothers.
IfIremovevlrevento
fromGROUPBY
itdoesnotallowmetocompleteSELECT
:
selectcodemp,codfunc,codevento,vlreventofromsankhya.TFPFOLwherecodemp=1andcodfunc=26andmonth(referencia)=1andyear(referencia)=2009groupbycodemp,codfunc,codeventohavingcount(1)=1
Mensagem8120,Nível16,Estado1,Linha22Acoluna'sankhya.TFPFOL.VLREVENTO'éinválidanalistadeseleçãoporquenãoestácontidaemumafunçãodeagregaçãonemnacláusulaGROUPBY.
AndifIremovethevlrevento
fromtheselectobviouslyitdoesnotshowmeintheresult
How can I tell the vlrevento
field in this select
without showing codeventos
that have duplicate value?
Thank you in advance