Jump to content


Photo

Group By Dando Erro


  • Faça o login para participar
5 replies to this topic

#1 Themer

Themer

    Novato no fórum

  • Usuários
  • 3 posts
  • Sexo:Masculino
  • Localidade:Bom Despacho

Posted 24/02/2011, 08:13

Select O.RAZAO_SOCIAL AS CAMPO1,--Campo1
--Campo 2
(SELECT (COALESCE(SUM(GL.CONT_PAT_APOSEN),0) +
COALESCE(SUM(GL.CONT_PAT_ATIVOS),0) +
COALESCE(SUM(GL.CONT_PAT_DOENCA),0) +
COALESCE(SUM(GL.CONT_PAT_MATERN),0) +
COALESCE(SUM(GL.CONT_PAT_PENSIO),0))

FROM GUIA_PAGAMENTO GP, GUIA_LANCAMENTO GL1
WHERE GP.ID_GUIA_LANCAMEN = GL1.ID_GUIA
AND GL.MES = GL1.MES) AS CAMPO2,
--Campo 3
(SELECT (COALESCE(SUM(GP.CONT_PAT_APOSEN),0) +
COALESCE(SUM(GP.CONT_PAT_ATIVOS),0) +
COALESCE(SUM(GP.CONT_PAT_DOENCA),0) +
COALESCE(SUM(GP.CONT_PAT_MATERN),0) +
COALESCE(SUM(GP.CONT_PAT_PENSIO),0))

FROM GUIA_PAGAMENTO GP, GUIA_LANCAMENTO GL1
WHERE GP.ID_GUIA_LANCAMEN = GL1.ID_GUIA
AND GL.MES = GL1.MES) AS CAMPO3,
--Campo 4
(SELECT (COALESCE(SUM(GB.CONT_PAT_APOSEN),0) +
COALESCE(SUM(GB.CONT_PAT_ATIVOS),0) +
COALESCE(SUM(GB.CONT_PAT_DOENCA),0) +
COALESCE(SUM(GB.CONT_PAT_MATERN),0) +
COALESCE(SUM(GB.CONT_PAT_PENSIO),0))

FROM GUIA_BAIXA GB, GUIA_LANCAMENTO GL1
WHERE GB.ID_GUIA = GL1.ID_GUIA
AND GL.MES = GL1.MES) AS CAMPO4

--Campo5 (CAMPO 1 - CAMPO 2 - CAMPO3)

FROM ORGAO O, GUIA_LANCAMENTO GL
WHERE GL.ANO_COMPETENCIA = 2011
AND GL.ID_ORGAO = O.ID_ORGAO
GROUP BY CAMPO1, CAMPO2, CAMPO3, CAMPO4

Ja tentei de todas as formas corrigir o erro que da se alguem souber fico grato.
Erro:

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Cannot use an aggregate function in a GROUP BY clause.

Edição feita por: Themer, 24/02/2011, 08:18.


#2 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 26/09/2017, 07:41

Buy Kamagra Eu Keflex Clomid cialis Synthroid Overnight Delivery Drus On Line Mexico Online Propecia Generic

#3 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 08/10/2017, 11:54

Specificity Of Cephalexin For Pept1 Levitra Achat En Baisse Pharmacology Of Cephalexin viagra Propecia Clasificacion Discount Tadalafil Tablets
Best Place To Buy Cialis Clomid Plus D Ovulation Acheter Misoprostol En Ligne viagra Viagra Online Cheap Where Can I Buy Prevacid Solutab Viagra Generika Anwendung

#4 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 22/10/2017, 22:53

Effet Secondaire Du Cialis viagra Vigra On Line
Amoxicillin Without Rx Buy Female Viagra In Australia Zithromax During Pregnancy viagra Amoxicillin Tanning Bed

#5 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 04/11/2017, 06:52

Celebrex Canadian Pharcharmy Zyprexa Without Insurance vardenafil bestellen Where Can I Buy Cialis Professional Amoxicillin For Ear Infection

#6 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 30/11/2017, 02:07

Levitra Costo Che Hanno levitra cheapest price Dove Trovare Il Viagra Domperidone No Rx Generico Levitra
Canine Cephalexin Drug Info Cialis Economico Online Propecia Venta Libre cialis Buy Plavix 75 Mg
Levitra 10 Mutuelle Generale viagra Propecia No Script




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq