On Thu, 1 May 2025 at 00:29, PALAYRET Jacques <jacques.palay...@meteo.fr> wrote:
> => In the subquery, the semantic analysis of the query considers the column " 
> dat " instead of the expression " to_char(dat,'yyyymm') ", which is actually 
> a grouped column.
> Is this normal? How can I simply resolve the problem?

Calculate the dat column in a subquery in the outer-level query.

Something like:

FROM (select *,to_char(dat, 'YYYYMM') as strdat from table1) table1
JOIN   table2   USING (num_poste)

then use strdat in all the places you're currently using to_char(dat, 'YYYYMM')

David


Reply via email to