sql question

From: "Duncan Adams (DNS)" <duncan(dot)adams(at)vcontractor(dot)co(dot)za>
To: Pgsql Novice <pgsql-novice(at)postgresql(dot)org>
Subject: sql question
Date: 2002-04-10 15:09:05
Message-ID: 7DD34E6DF5CD1B4283DDAB96A855DCED2F322B@vodabemail1.vodacom.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all

Can anyone tell me if there is a way of doing the query bellow, do i have to
do 4 queries or is there a way of just doing one?

thanx in advance.

the following table tells me is who (per_key) is a systems manager,
administrator, second call out and hardware call out for a system.

Table "per_sys"
Attribute | Type | Modifier
------------+----------+----------
system_key | smallint |
per_key | smallint |
man | boolean |
admin | boolean |
second | boolean |
hard | boolean |

select
system.name as name,
personal.name ||' '|| personal.surname as name_man,
personal.name ||' '|| personal.surname as name_admin,
personal.name ||' '|| personal.surname as name_second,
personal.name ||' '|| personal.surname as name_hard
where
system.name IS NOT NULL and
per_sys.per_key != 0 and
((personal.key_personal = per_sys.per_key and per_sys.man = 't') or
(personal.key_personal = per_sys.per_key and per_sys.admin = 't') or
(personal.key_personal = per_sys.per_key and per_sys.second = 't') or
(personal.key_personal = per_sys.per_key and per_sys.hard = 't'))
order by system.name;

Browse pgsql-novice by date

  From Date Subject
Next Message Joseph Molnar 2002-04-10 15:56:29 Re: Question on oid's
Previous Message Joshua b. Jore 2002-04-10 13:49:49 Re: INSERT failing because of CONSTRAINT