making two columns out of one

Поиск
Список
Период
Сортировка
От Frank Bax
Тема making two columns out of one
Дата
Msg-id 3.0.6.32.20000911093447.01fcb4c0@execulink.com
обсуждение исходный текст
Ответы Re: making two columns out of one
Список pgsql-sql
I've got a table containing some timesheet data.
Fields are emp, earncode, lo_shift, hi_shift.

SELECT emp, sum(hi_shift - lo_shift) as reghrs from timesheet 
where earncode in ('R', 'C', 'X') order by emp

will give me all the regular hours

SELECT emp, sum(hi_shift - lo_shift) as ovrhrs from timesheet 
where earncode not in ('R', 'C', 'X') order by emp

will give me all the overtime hours.

How do I combine these to get one result set with emp, reghrs, ovrhrs on
each row.

Frank




________________________________________________________                          1stUp.com - Free the Web  Get your
freeInternet access at http://www.1stUp.com
 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: need asap: bg_BG locale for FreeBSD
Следующее
От: Palle Girgensohn
Дата:
Сообщение: Re: need asap: bg_BG locale for FreeBSD