Results 1 to 4 of 4

Thread: Join.

  1. #1
    Join Date
    Feb 2004
    Posts
    13

    Unanswered: Join.

    select e.dname, count(e.sid) as total_num from enroll e
    group by e.dname

    select e.dname, count(e.sid) as "major_enroll"
    from enroll e, major m
    where e.sid = m.sid and e.dname = m.dname
    group by e.dname
    -----------------------------------------------------------------------
    Hi, buddys,
    How can I join above two results of queries by dname if I don't have any create temporary table permission???

    Thx,

    Neil

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    PHP Code:
    select e.dnamecount(e.sid) as total_num 
    from enroll e 
    group by e
    .dname

    UNION

    select e
    .dnamecount(e.sid) as "major_enroll" 
    from enroll emajor m 
    where e
    .sid m.sid 
      
    and e.dname m.dname
    group by e
    .dname
    It works with Oracle ...

  3. #3
    Join Date
    Feb 2004
    Posts
    13

    Not union

    Originally posted by Littlefoot
    PHP Code:
    select e.dnamecount(e.sid) as total_num 
    from enroll e 
    group by e
    .dname

    UNION

    select e
    .dnamecount(e.sid) as "major_enroll" 
    from enroll emajor m 
    where e
    .sid m.sid 
      
    and e.dname m.dname
    group by e
    .dname
    It works with Oracle ...

  4. #4
    Join Date
    Feb 2004
    Posts
    13

    not union

    I don't need to union set, I mean.
    I want total_num and major_enroll are two columns in the same table.

    thx.
    neil

    Originally posted by Littlefoot
    PHP Code:
    select e.dnamecount(e.sid) as total_num 
    from enroll e 
    group by e
    .dname

    UNION

    select e
    .dnamecount(e.sid) as "major_enroll" 
    from enroll emajor m 
    where e
    .sid m.sid 
      
    and e.dname m.dname
    group by e
    .dname
    It works with Oracle ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •