sql question
От | Duncan Adams (DNS) |
---|---|
Тема | sql question |
Дата | |
Msg-id | 7DD34E6DF5CD1B4283DDAB96A855DCED2F322B@vodabemail1.vodacom.co.za обсуждение исходный текст |
Список | 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;
В списке pgsql-novice по дате отправления: