COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: madhancog on 04 Mar 2010 04:28:09 AM

Title: How the SQL generated by cognos
Post by: madhancog on 04 Mar 2010 04:28:09 AM
Hi Gurus,
  Can i know the difference of SQL generated by cognos for before aggregation and after aggregation,can any one give the SQL.


Thanks in advance
K.M
Title: Re: How the SQL generated by cognos
Post by: paddhu on 04 Mar 2010 07:31:01 AM
Why don't you get it yourself. Here's how you can get that.
Go to Tools -> Show generated SQL/MDX
Title: Re: How the SQL generated by cognos
Post by: Gopinath on 04 Mar 2010 10:56:51 AM
Hi,

The difference between before and after aggregation is exactly the same as WHERE and HAVING clause in SQL

say you have a table like

Scenario1 (Before aggregation)
Column1            Column2
A                       10
A                       20

Fileter Expression : Column1 > 10  and Application: Before auto aggregation

The result would be
Column1            Column2
A                         20

SQL would be like
select column1, sum(column2) from table where column2 > 10



Scenario2 (After aggregation)
Column1            Column2
A                       10
A                       20

Fileter Expression : Column1 > 10  and Application: After auto aggregation

The result would be

Column1            Column2
A                         30

SQL would be like
select column1, sum(column2) from table group by column1 having sum(column2) > 10



Title: Re: How the SQL generated by cognos
Post by: madhancog on 04 Mar 2010 10:37:59 PM
Thanks  a lot...


Regards,
K.M