|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
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
|
|||
|
|||
|
Oracle Query Question
Hello...
I'm starting to get the hang of this Oracle thing, however, I have a query that I'm having difficulty with. I have 2 tables with the following information Table 1 -------- SubGroupId infoType infoCount Table 2 ------- GroupId SubGroupId I need to perform a query that will list a total of all of the infoCount information for a given groupId and a given infoType. For instance, I may have 2 subgroups belonging to a single group id. However, I want to find out the total of the two infoCounts for each different infoType. Can someone please help? Thanks! |
|
#2
|
|||
|
|||
|
Code:
select sum(infoCount) from table1 where infoType = <yourGivenValue> and subGroupId in (select subGroupId from table2 where groupId = <yourGivenValue>) Not sure what you mean by "the total of all of the infocount" though. |
|
#3
|
|||
|
|||
|
Thanks swampBoogie. Except I made a minor error in my question. I really do not have a field called "infoCount" rather there is an entry for each subGroupId of a givent infoType. And I need to count up each of these records that apply to each GroupId.
Thank you Quote:
|
|
#4
|
|||
|
|||
|
Sorry, there was a mistake made earlier...
There is not an infoCount variable available. Rather there is an entry in the table for each instance of the item. So basically there could be 2 items with the same sub group id, and same infoType. Any suggestions? |
|
#5
|
|||
|
|||
|
Like
Code:
select count(*) from table1 where infoType = <yourGivenValue> and subGroupId in (select subGroupId from table2 where groupId = <yourGivenValue>) ? |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Oracle Query Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|