Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Combining columns of two tables

Re: Combining columns of two tables

From: Sameer <dolpheen_at_gmail.com>
Date: 26 Oct 2006 05:40:39 -0700
Message-ID: <1161866439.575119.77030@e3g2000cwe.googlegroups.com>

On Oct 26, 1:25 pm, "sybrandb" <sybra..._at_gmail.com> wrote:
> On Oct 26, 8:28 am, "Sameer" <dolph..._at_gmail.com> wrote:
>
>
>
>
>
> > Please have a look at this query.
>
> > SELECT mr_issues_aging.*, notclosed
> > FROM mr_issues_aging,
> > (SELECT MODULE AS m,
> > COUNT(MODULE) AS notclosed FROM mr_issue_details
> > WHERE NOT(laststatus = 'Close')
> > GROUP BY MODULE)
> > WHERE m = mr_issues_aging.MODULE
>
> > I want to create a table having columns of both mr_issues_aging and
> > inner query.
> > This query is combining columns of both tables but both tables do not
> > have same number of rows. The mr_issues_aging table is having one more
> > row than the inner query, therefore I am not getting the expected
> > output.
> > Is this a proper way to add columns from two tables?
> > How to resolve this? Can I add some dummy rows to inner query by using
> > union, but how to do this?
> > Please help.
> > -SameerHint: look up 'Outer join' in the documentation (SQL reference manual,
> and/or Application Developers Manual) and change the join accordingly.
> Preferably basic questions like this are best answered by manuals, not
> by posting them here.
>
> --
> Sybrand Bakker
> Senior Oracle DBA- Hide quoted text -- Show quoted text -

Thanks! The query worked for me is:

SELECT mr_issues_aging.*,
  notclosed
FROM mr_issues_aging,

    (SELECT MODULE AS m,
     COUNT(MODULE) AS
  notclosed
   FROM mr_issue_details
   WHERE NOT(laststatus = 'Close')
   GROUP BY MODULE)
WHERE mr_issues_aging.MODULE(+) = m Received on Thu Oct 26 2006 - 07:40:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US