From: | "news1(dot)on(dot)sympatico(dot)ca" <m(dot)rullo(at)sympatico(dot)ca> |
---|---|
To: | pgsql-questions(at)postgresql(dot)org |
Subject: | SQL query question |
Date: | 2000-04-11 20:56:12 |
Message-ID: | MjMI4.18663$2D6.532231@news20.bellglobal.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I've been having problems with this query. The second sub-query will not
always return data.
When that is the case, main query will not return a value, even though the
first query does.
Would anyone have any suggestions as to how I could return the
events.EventCost even if
registration.registrationRegCost is null?
SELECT (events.EventCost + registration.registrationRegCost) AS subtotal
FROM (SELECT [Event Registration].RegID AS eventRegID,
SUM(Events.EventCost) AS EventCost
FROM Events INNER JOIN
[Event Registration] ON
Events.ID = [Event Registration].EventID
WHERE [Event Registration].RegID = 399
GROUP BY [Event Registration].RegID) AS events,
(SELECT dbo.[Registration Information].RegID AS
registrationRegID,
dbo.[Registration Types].RegCosts AS registrationRegCost
FROM dbo.[Registration Information],
dbo.[Registration Types]
WHERE dbo.[Registration Information].RegType =
dbo.[Registration Types].RegTypeID
AND dbo.[Registration Information].RegID = @regid2) AS
registration
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2000-04-11 21:38:26 | Re: Features |
Previous Message | Frank Miles | 2000-04-11 20:45:44 | get_groname() ??? |