COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: nbora on 01 Feb 2024 08:58:47 AM

Title: Grouping by datetime column components
Post by: nbora on 01 Feb 2024 08:58:47 AM
Hi,

here is a newbie to Cognos and to the community here.

I'm trying to run a fairly simple SQL Query in Cognos but it fails.

SELECT COUNT(*) AS n_rows, LAST_DAY(DATETIME_COLUMN), MONTH(DATETIME_COLUMN), YEAR(DATETIME_COLUMN) FROM MY_TABLE GROUP BY LAST_DAY(DATETIME_COLUMN), MONTH(DATETIME_COLUMN), YEAR(DATETIME_COLUMN)

Any tip/help is greatly appreciated.

Cheers,
Bora
Title: Re: Grouping by datetime column components
Post by: cognostechie on 02 Feb 2024 01:09:46 AM
What's the error you get?

Is the SQL used as a 'Native' SQL or 'Cognos' or 'pass-through' SQL?

If it is used as a Native SQL what's the database? SQL Server does not have any LAST_DAY function but MySQL and Oracle have. The more information you provide in your 1st question, the faster you will get the answer.