Re: using a common key value on both sides of a union ?

2020-04-02 Thread Laurenz Albe
On Wed, 2020-04-01 at 19:39 -0400, David Gauthier wrote: > psql (9.6.7, server 11.3) on linux > > I want to do something like this > (intentionally bad sql but will illustrate the need) > > select s.name,s.grade from students s where s.class='math' > union > select 'whole class', class_grade fro

Re: using a common key value on both sides of a union ?

2020-04-01 Thread David G. Johnston
On Wednesday, April 1, 2020, David Gauthier wrote: > psql (9.6.7, server 11.3) on linux > > I want to do something like this > (intentionally bad sql but will illustrate the need) > > select s.name,s.grade from students s where s.class='math' > union > select 'whole class', class_grade from all_c

using a common key value on both sides of a union ?

2020-04-01 Thread David Gauthier
psql (9.6.7, server 11.3) on linux I want to do something like this (intentionally bad sql but will illustrate the need) select s.name,s.grade from students s where s.class='math' union select 'whole class', class_grade from all_classes where class=s.class Of course it's that "where class=s.clas