Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 10th, 2005, 09:39 PM
Michal Augustyn Michal Augustyn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 103 Michal Augustyn User rank is Private First Class (20 - 50 Reputation Level)Michal Augustyn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 13 h 44 m 16 sec
Reputation Power: 4
Selecting the largerst doulbe

I've got an assignment which wants me to select the alrgest count of a certain entity.

I've got a table of reserve books and I have to select the book that was reserved most. I can easily calculate the total reserves for each book, but how the hell do I select the largest?!

Code:

select 
	call_number, count(call_number) 
from 
	reserve
where
	to_char(reserve_date, 'DD-Mon-YY') like '%Jul%'
group	by
	call_number;	


I.e. all I'm interested in are the call_number and their count.
♀Call Number COUNT(CALL_NUMBER)
-------------------- ------------------
AML-3C60 2
AML-3C62 1
AML-3C63 1
AML-3C65 1

is the answer I get.

It's oviousl that the top one's the book with the highest count.
The question is, how do I get just that tuple?

Reply With Quote
  #2  
Old August 15th, 2005, 02:28 PM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 6
I am using the same query, find the modification in red color

Code:
select 
	call_number, max(count(call_number) )
from 
	reserve
where
	to_char(reserve_date, 'DD-Mon-YY') like '%Jul%'

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Selecting the largerst doulbe


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT