Re: Same column names in a subresult table

2021-05-14 Thread David G. Johnston
On Friday, May 14, 2021, Durumdara wrote: > > Is there any way to suppress the original field? > Remove the star and list the other columns you do want. > > Or say to PGSQL to skip the first XDate field? > > Like select t.* (EXCEPT XDate) from t > No, though I’ve expressed a desire for this

Re: Same column names in a subresult table

2021-05-14 Thread Rory Campbell-Lange
On 14/05/21, Durumdara (durumd...@gmail.com) wrote: > ... > midqry1 as ( > select coalesce(XDate , '0001-01-01'), * from prevqry > ), > midqry2 as ( > select ArtID, max(XDate) as Max_XDate from midqry1 > where acq = True > group by ArtID > ) > ... > > Result: ERROR: column reference "XDate

Same column names in a subresult table

2021-05-14 Thread Durumdara
Hello! I have a big "WITH QUERY", with many subqueries. I have a date field, named "XDate". In the middle I duplicated this field: ... midqry1 as ( select coalesce(XDate , '0001-01-01'), * from prevqry ), midqry2 as ( select ArtID, max(XDate) as Max_XDate from midqry1 where acq = True