Received: from rad3.1stup.com (IDENT:root@rad3.1stup.com [209.143.242.34]) by hub.org (8.10.1/8.10.1) with ESMTP id e8BDgXX78556 for ; Mon, 11 Sep 2000 09:42:33 -0400 (EDT) Received: from BAX8 (atlanta-ip-1-243.dynamic.ziplink.net [209.206.51.243]) by rad3.1stup.com (8.10.1/8.9.3) with SMTP id e8BDgPA20625 for ; Mon, 11 Sep 2000 06:42:26 -0700 Message-Id: <3.0.6.32.20000911093447.01fcb4c0@execulink.com> X-Sender: fbax@execulink.com X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Date: Mon, 11 Sep 2000 09:34:47 -0400 To: pgsql-sql@postgresql.org From: Frank Bax Subject: making two columns out of one Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200009/64 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