SunQuest
           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:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 24th, 2004, 02:11 PM
kikkid97 kikkid97 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 kikkid97 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 13 sec
Reputation Power: 0
Can you reference count(x) in a subquery?

SELECT COUNT(CHILDREN)
FROM TABLE_A, TABLE_B
WHERE TABLE_A.PARENT_ID = TABLE_B.PARENT_ID

That will get me the number of children belonging to each parent. I want to select all the parents who have a certain amount of children, for example, select all the parent_id's of parents who have 10 or more children. Is this possible?

Reply With Quote
  #2  
Old June 24th, 2004, 04:14 PM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
Code:
SELECT COUNT(CHILDREN), a.Parentid
FROM TABLE_A A, TABLE_B B
WHERE A.PARENT_ID = B.PARENT_ID
group by a.Parentid having count(children) >= 10;

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Can you reference count(x) in a subquery?


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 4 hosted by Hostway