![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
select INQMSIS.mine_tbl.sic_desc, COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM), COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM) * 200000 from INQPROD.ACC_INJ_TBL, INQMSIS.mine_tbl where ((INQMSIS.mine_tbl.c_m_ind = 'M') and (INQPROD.ACC_INJ_TBL.INJ_DEGR_CD IN ('01', '02', '03', '04', '05', '06')) and ((to_number(to_char(INQPROD.ACC_INJ_TBL.AI_DT,'YYY Y' ))) = 2009)) and INQPROD.ACC_INJ_TBL.MINE_ID = INQMSIS.mine_tbl.mine_id group by INQMSIS.mine_tbl.sic_desc order by 1 ; I am trying to modify a query to show an additional column. *This column is suppose to multiply the Count Document No. column by 200,000. *I am a beginner and cannot figure out what I'm doing wrong. Can somebody get me on the right path. Thanks Don |
#3
| |||
| |||
|
|
On May 19, 11:50 am, Don B<Braenovich.... (AT) DOL (DOT) GOV> wrote: select INQMSIS.mine_tbl.sic_desc, COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM), COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM) * 200000 from INQPROD.ACC_INJ_TBL, INQMSIS.mine_tbl where ((INQMSIS.mine_tbl.c_m_ind = 'M') and (INQPROD.ACC_INJ_TBL.INJ_DEGR_CD IN ('01', '02', '03', '04', '05', '06')) and ((to_number(to_char(INQPROD.ACC_INJ_TBL.AI_DT,'YYY Y' ))) = 2009)) and INQPROD.ACC_INJ_TBL.MINE_ID = INQMSIS.mine_tbl.mine_id group by INQMSIS.mine_tbl.sic_desc order by 1 ; I am trying to modify a query to show an additional column. This column is suppose to multiply the Count Document No. column by 200,000. I am a beginner and cannot figure out what I'm doing wrong. Can somebody get me on the right path. Thanks Don It would be helpful if you would post the actual Oracle error message you are receiving or at least explicitly state what issue you face. Generally speaking when you use a group by clause every column in the select list either has to be part of the group by clause or have an aggregate function applied to it. If you try to reference individual column values you get an error. Perhaps you want sum(col * 200000) or 200000 * sum(col) but from your post I cannot tell. |
|
HTH -- Mark D Powell -- |
#4
| |||
| |||
|
|
select INQMSIS.mine_tbl.sic_desc, COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM), COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM) * 200000 from INQPROD.ACC_INJ_TBL, INQMSIS.mine_tbl where ((INQMSIS.mine_tbl.c_m_ind = 'M') and (INQPROD.ACC_INJ_TBL.INJ_DEGR_CD IN ('01', '02', '03', '04', '05', '06')) and ((to_number(to_char(INQPROD.ACC_INJ_TBL.AI_DT,'YYY Y' ))) = 2009)) and INQPROD.ACC_INJ_TBL.MINE_ID = INQMSIS.mine_tbl.mine_id group by INQMSIS.mine_tbl.sic_desc order by 1 ; |
#5
| |||
| |||
|
|
Op 21-5-2010 16:13, Mark D Powell schreef: On May 19, 11:50 am, Don B<Braenovich.... (AT) DOL (DOT) GOV> *wrote: select INQMSIS.mine_tbl.sic_desc, COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM), COUNT (INQPROD.ACC_INJ_TBL.AI_DOC_NUM) * 200000 from INQPROD.ACC_INJ_TBL, INQMSIS.mine_tbl where ((INQMSIS.mine_tbl.c_m_ind = 'M') and (INQPROD.ACC_INJ_TBL.INJ_DEGR_CD IN ('01', '02', '03', '04', '05', '06')) and ((to_number(to_char(INQPROD.ACC_INJ_TBL.AI_DT,'YYY Y' ))) = 2009)) and INQPROD.ACC_INJ_TBL.MINE_ID = INQMSIS.mine_tbl.mine_id group by INQMSIS.mine_tbl.sic_desc order by 1 ; I am trying to modify a query to show an additional column. *This column is suppose to multiply the Count Document No. column by 200,000. *I am a beginner and cannot figure out what I'm doing wrong.. Can somebody get me on the right path. Thanks Don It would be helpful if you would post the actual Oracle error message you are receiving or at least explicitly state what issue you face. Generally speaking when you use a group by clause every column in the select list either has to be part of the group by clause or have an aggregate function applied to it. *If you try to reference individual column values you get an error. Perhaps you want sum(col * 200000) or 200000 * sum(col) but from your post I cannot tell. What is the difference? HTH -- Mark D Powell -- Shakespeare |
![]() |
| Thread Tools | |
| Display Modes | |
| |