SQL (in Progress Database) - How to use Where clause on calculated field

Discussão em 'StackOverflow' iniciado por fdantas, Maio 19, 2017.

  1. fdantas

    fdantas Administrator Moderador

    I'm pretty new to SQL, I've been using SQL on a Progress Database, I have the following code below:

    Select pub."GL_Table"."AccNum_Col", pub."GL_Table"."AccMnth_Col", Sum(pub."GL_Table"."Amount_Col"), ROUND((pub."GL_Table"."AccMnth_Col")/100,0) AS "Year", MOD(pub."GL_Table"."AccMnth_Col",100) As "Month"
    FROM pub."GL_Table"
    GROUP BY pub."GL_Table"."AccNum_Col", pub."GL_Table"."AccMnth_Col"
    ORDER BY pub."GL_Table"."AccNum_Col", pub."GL_Table"."AccMnth_Col"


    I want to only display only those rows with "Year" 2017

    I have tried the below (but I receive errors):

    Select * FROM (
    Select pub."GL_Table"."AccNum_Col", pub."GL_Table"."AccMnth_Col", Sum(pub."GL_Table"."Amount_Col"), ROUND((pub."GL_Table"."AccMnth_Col")/100,0) AS "Year", MOD(pub."GL_Table"."AccMnth_Col",100) As "Month"
    FROM pub."GL_Table"
    GROUP BY pub."GL_Table"."AccNum_Col", pub."GL_Table"."AccMnth_Col"
    ORDER BY pub."GL_Table"."AccNum_Col", pub."GL_Table"."AccMnth_Col"
    )
    WHERE "Year" = 2017


    Can anyone assist me?

    Thanks in advance

    Continue reading...

Compartilhe esta Página