Group by only select 1 record in Aggregate
Question


In this Aggregate, only consist of 1 Entity. Already group by several attribute. Need to group by 1 more attribute (CD) but need select only CD with the minimum Date (DT) in this case will only need CD with value '064'  

Hi Nadzir,

if you could at the end append the instruction having min(dt) that would resolve the question. 

I'am sorry but at this time I don't have the time to test with the platform.

select ...

from ....

group by ...

order by ....

having min(dt)

Regards

Hi Nadzir Yahaya,

As you have two different values for the Group By already made, you won't be able to use an aggregate to get what you want. Despite of that, you could use an SQL widget and the HAVING clause, as carl ruhle told you to do.

You can use your aggregate to help you create an SQL widget. To do that, follow these steps:

  1. Double click on the aggregate to open the editor;
  2. Click on anywhere instead of the data table to show the Aggregate properties
  3. Double click on Executed SQL
  4. Copy the query. (Because you are using group by, it will not allow you to convert to an aggregate. Nonetheless, it will give you the query, what will help you to save some time)

Hope it helps.

Best regards.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.