pg 15.3 on linux
I don't even know if the title makes sense, I think it's better explained
with an example
This is the table...
dvdb=# \d dispatch_tracker
Table "regr.dispatch_tracker"
Column| Type | Collation | Nullable |
Default
Hi:
psql 15.3
I have a table with sets of observations, each set sharing an id.
I want to get the average of the max of each set.
id | val
---
1 5.0
1 4.3
1 3.8
2 4.8
2 6.0
2 2.9
3 4.1
3 4.4
3 8.0
So I want the avg of the max of the set where id=1 (5
Wow !
That did it, even with the predicate I stuck on the end when I tried it.
Thanks Depesz !
On Mon, Nov 3, 2025 at 12:22 PM hubert depesz lubaczewski
wrote:
> On Mon, Nov 03, 2025 at 12:18:55PM -0500, dfgpostgres wrote:
> > psql (13.2, server 15.3) on linux
> >
> > I
psql (13.2, server 15.3) on linux
I think they call this "unpivot" in MSSQL ?
How can I get an sql query to return one line per column with... an ID,
column name and value. the ctid for the id field is fine.
Example:
dvdb=# create table unpivot (intcol integer, floatcol float, strcol
varchar);