Skip site navigation (1) Skip section navigation (2)

selecting problems

From: "Shaun Watts" <SWatts(at)computer-systems(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: selecting problems
Date: 2003-10-31 19:19:49
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
What I am trying to do is select all the rows out of the categories
table (see below) and select the sum of j_amount out of the judgment
table.  Right now it is only returning the categories that are in the
judgment table.  I want it to return those fields with the amounts out
of the judgment table, but also the all the other categories from the
categories table with 0 as there amount.  Does anyone have a

select ca_code,ca_desc,sum(j_amount) as sum_amt,ca_dis_cycle
from categories LEFT OUTER JOIN judgment ON
where j_case_no='45698'
and j_party_no=1
group by ca_code,ca_desc,ca_dis_cycle

Shaun, <mailto:swatts(at)computer-systems(dot)com> 
Phone 1-317-913-4160 Fax 1-317-913-4175 
CSI - Computer Systems, Inc. <>
"Dictionary is the only place that success comes before work. Hard work is the price we 
must pay for success. I think you can accomplish anything if you're willing to pay the price."
Vince Lombardi 


pgsql-sql by date

Next:From: Tomasz MyrtaDate: 2003-10-31 19:53:12
Subject: Re: selecting problems
Previous:From: mlunnon @ RWADate: 2003-10-31 18:14:56
Subject: Re: conditional query?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group