Using an alias in a group by

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Using an alias in a group by

Postby christopher.gomes » Fri Sep 15, 2023 6:10 pm

Is it possible to add a result with an alias and then group by that alias?

Code: Select all
   
query.result.add(
         query.case.when(
            query.and
            .add(query.columns.type.eq(1))
            .add(joinQuery.columns.uuid.not.isnull)
            ).then(query.columns.creation_date.year)
            .else(query.columns.cancelled_date.year)
      
      , 'compare_date_year')

queryPolicyCanLap.groupBy....


I've tried the addColumn but that doesn't work as I think that's looking for a field in the table
christopher.gomes
 
Posts: 5
Joined: Tue Apr 07, 2020 4:52 pm

Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 34 guests

cron