SQL query question
От | news1.on.sympatico.ca |
---|---|
Тема | SQL query question |
Дата | |
Msg-id | MjMI4.18663$2D6.532231@news20.bellglobal.com обсуждение исходный текст |
Список | 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
В списке pgsql-general по дате отправления: