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: Help!!! Complex SQL (For Pros Only)

Re: Help!!! Complex SQL (For Pros Only)

From: Mark Gumbs <mgumbs_at_nospam.hotmail.com>
Date: Mon, 21 Jun 1999 11:42:35 +0100
Message-ID: <376e14c8.0@145.227.194.253>


I haven't actually tried the code out but....

select

    h.id_code Header_code,
    h.descr Description,
    count(c.id) Content_Count,
    count(l.id) Link_Count
from

    Links l,
    Content C,
    Header H
where

            H.id_code = C.header_code
and     H.id_code = L.header_code
group by
            ID_code, Descr


Mark

bonanos_at_yahoo.com wrote in message <7kl149$60o$1_at_nnrp1.deja.com>...
>Hi
>
>I have three tables.
>
>1. [HEADER] is the master table
>---------------------------------------------------------
> id_code -- Unique identifier
> cat_code -- Category code that this header falls under
> descr -- Header text
>
>2. [CONTENT] is a detail table (many to [HEADER])
>---------------------------------------------------------
> id -- Unique identifier
> title -- title of the document
> cdate -- Date document was added
> Author -- Author of the document
> cfile -- The name of the file
> ftype -- The type of file (html, audio,jpeg etc)
> Header_Code -- link to id_code in [Header table]
> cat_code -- Category this document is in.
>
>3. [LINKS] is a detail table (many to [HEADER])
>---------------------------------------------------------
> id -- Unique identifier
> cat -- Category this document is in.
> l_name -- the text of the links
> l_url -- the actual http:// address
> Summary -- a description
> Header_Code -- link to id_code in [Header table]
>
>
>
>
>What I want to produce is the following query result
>
>Header_code Description content_count link_count
>------------------------------------------------------------------
>123 Agriculture Policy 12 3
>236 Agriculture Projects 3 3
>123 Agriculture Budgets 5 0
>
>
>
>You get the piicture, let me express it verbally.
>
>I want all the Headers in a category with a count of documents and link
>for each header.
>
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Mon Jun 21 1999 - 05:42:35 CDT

Original text of this message

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