Re: Query question

From: Gerard H. Pille <>
Date: Wed, 31 Aug 2011 03:19:30 +0200
Message-ID: <4e5d8c04$0$5036$>

The Magnet wrote:
> On Aug 30, 1:56 pm, "Gerard H. Pille"<> wrote:
>> The Magnet wrote:
>>> Hi,
>>> We have a massive query. But there is a problem. One of the
>>> subqueries does not return any rows, therefore the entire query
>>> returns no rows. I need to make it is one of the subqueries has no
>>> results, then it just gets NULL or 0. The query is below. Can
>>> someone help?
>>> Thanks!
>> That is normally solved with an "outer join". Check it out.
> I'm not sure how I would do this with an outer join, since all of the
> columns are basically subqueries. If one of the subqueries returns no
> results, why does the entire query fail?

As David showed you, you are still joining your "subqueries" (I think in your case they are views). The minute one of them returns no rows, the whole query returns no rows.

Anyhow, you better take Luuk's advice and have someone who knows SQL & RDBMS rewrite your selection. Or was this query generated? Received on Tue Aug 30 2011 - 20:19:30 CDT

Original text of this message