Announcement

Collapse
No announcement yet.

Whats wrong in this statment?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Whats wrong in this statment?

    Hi,

    I'm trying to sum some values only if the month is january, but when I try to run, scriptcase is stuck. This is my SQL statment

    SELECT
    RV2_Fecha,
    RV2_Cliente,
    RV2_Actividad,
    SUM(IF (MONTH('{RV2_Fecha}') = 1, RV2_PAX, 0)) as Ene_PAX,
    SUM(IF (MONTH('{RV2_Fecha}') = 1, RV2_Importe + RV2_Transporte + RV2_LunchDin + RV2_ActExtra, 0)) as Ene_TotVta,
    SUM(IF (MONTH('{RV2_Fecha}') = 1, RV2_Deposito + RV2_Comision, 0)) as Ene_TotCom,
    RV2_Cancelado,
    RV2_Pagado
    FROM
    RV2_Reserv2
    WHERE RV2_Cancelado <> '1' AND RV2_Pagado = '1'
    GROUP BY RV2_Cliente, RV2_Actividad

    Regards

    Gerardo

  • #2
    Hello Gerardo,

    If you run this Statement on your RDBMS does it works?

    regards,
    Bernhard Bernsmann

    Comment


    • #3
      Bernhard:

      I had not run, but in doing so I'm realizing that I did not give the expected result.
      I have a couple of reports with the same statement without the IF statement which are working very well.
      I need another way to think better and get the sum for months.

      Thank you

      Comment


      • #4
        No problem, Glad I could help.

        regards,
        Bernhard Bernsmann

        Comment

        Working...
        X