From: Frank Bax <fbax@execulink.com>
To: pgsql-sql@postgresql.org
Subject: making two columns out of one
Date: Mon, 11 Sep 2000 09:34:47 -0400
Message-ID: <3.0.6.32.20000911093447.01fcb4c0@execulink.com> (raw)
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 free Internet access at http://www.1stUp.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: fbax@execulink.com
Subject: Re: making two columns out of one
In-Reply-To: <3.0.6.32.20000911093447.01fcb4c0@execulink.com>
References: <3.0.6.32.20000911093447.01fcb4c0@execulink.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox