|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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; |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Can you reference count(x) in a subquery? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|