0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOSにPostgreSQL コード2

0
Posted at
postgres=# create view clubgroup(name,age,address,flag,id,clubname)
as
select * from grouplist as g left outer join clublist as c on g.flag=c.id ;
postgres=# select
postgres-# sum(case when(age between 20 and 29) and (clubname='tennis') then 1 else 0 end)as hoge1,
postgres-# sum(case when(age between 30 and 39) and (clubname='music') then 1 else 0 end)as hoge2,
postgres-# sum(case when(age between 40 and 49) and (clubname='baseball') then 1 else 0 end)as hoge3
postgres-# from clubgroup ;


 hoge1 | hoge2 | hoge3
-------+-------+-------
     8 |     7 |     1
select * from flaglist1 as f
left outer join clublist as c
on f.flag = c.id ;


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?