Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2003
    Posts
    7

    Unanswered: 111

    abc
    Last edited by uelwilson; 10-13-03 at 04:43.

  2. #2
    Join Date
    Sep 2003
    Location
    Milan, Italy
    Posts
    130
    select * from
    (select p.name, sum(quantity) as Total
    from sales s, pharmacy p
    where s.pharmacyno = p.pharmacyno
    group by p.name
    order by total desc)
    where rownum <= 1;

    Should work - not tested it.

    Of course, you may have two winners ... that would give only one pseudo-randomly.

    Al

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you guys should all get together

    http://www.dbforums.com/showthread.php?threadid=927866


    what school is this?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Oct 2003
    Posts
    12
    Originally posted by r937
    you guys should all get together
    what school is this?

    hehe.

  5. #5
    Join Date
    Sep 2003
    Location
    Milan, Italy
    Posts
    130
    Originally posted by r937
    you guys should all get together

    what school is this?
    ;-)

    OOps - if that's homework, i don't know whether the rownum can be classified as standard SQL - you may get a bad mark for having used the most efficient *Oracle* technique; anyway if i'm not mistaken, this is an Oracle forum, so ...

    Al

  6. #6
    Join Date
    Oct 2003
    Posts
    12
    Originally posted by alberto.dellera
    ;-)

    OOps - if that's homework, i don't know whether the rownum can be classified as standard SQL - you may get a bad mark for having used the most efficient *Oracle* technique; anyway if i'm not mistaken, this is an Oracle forum, so ...

    Al

    I don't see anything wrong with it. I am gonig to take my OCP, DBA exams soon and I use the rownum. I assume Oracle DBA exams accept rownum as a standard procedure.

    I took MS certs before and MS has "their" way of doing things which are not as efficient as my/sysadmin way of doing thing.

  7. #7
    Join Date
    Sep 2003
    Location
    Milan, Italy
    Posts
    130
    Originally posted by Seraph
    I don't see anything wrong with it. I am gonig to take my OCP, DBA exams soon and I use the rownum. I assume Oracle DBA exams accept rownum as a standard procedure.

    Absolutely ok in an ocp, but probably not in a college exam (they try to use only "standard features" in college classes) - hence my warning.

    Al

Posting Permissions

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