[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] SQR SQL Sub-Selects



Hi All,

I have the following SQL that I would like to use in SQR.  This goes
against an Informix database.

select
        acct,
        record_type,
        sum(amt1),
        sum(amt2),
        sum(amt3)
from
(
        select
                acct,
                case when amt1 > 0 and amt1 < 5000 then "record_type1
else then "record_type2" end,
                case when status = "open" and amt1 > 0 then 1 else 0
end,
                case when status = "open" and amt2 > 0 then 1 else 0
end,
                case when status = "open" and amt3 > 0 then 1 else 0 end
        from table1
        where (where clause)
        group by 1, 2
) as temp1

group by 1, 2
order by 1
;

Does anyone know if this is possible in SQR?

Thank you,
Kent

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users