Results 1 to 2 of 2

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 if I don't have any create temporary table permission???

    Thx,

    Neil

  2. #2
    Join Date
    Aug 2002
    Location
    Madrid, Spain
    Posts
    97

    Re: Join.

    Originally posted by neiljchen
    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 if I don't have any create temporary table permission???
    Neil
    UNION ALL is almost what you want. It will give
    a single result set with data from both queries.
    Unfortunately, it doesn't allow to GROUP the
    whole result set; only each select. So, you may
    get two rows per e.dname value, one from each
    query.

    Regards,
    Mariano Corral

Posting Permissions

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