Doing calculations on a table or group of tables

Table A
Name          Length
REDBOX          45
GREENBOX     67
YELLOWBOX     89
PINKBOX          23
How would I write a query that would count the number of rows in the table
which is this case is 4 (count* maybe) , add up the four values in length
(using sum () I think) and then multiply both values together.
So ( num of rows ) * ( sum (length)) = Result.
I would like to displat the Result as an extra row but not sure you can do that...

hi
SQL> ed
Wrote file afiedt.buf
1 select t.table_name,count(column_name)
2 from user_tables t, user_tab_columns c
3 where t.table_name = c.table_name
4* group by t.table_name
SQL> /
SQL> /
TABLE_NAME COUNT(COLUMN_NAME)
BIN$48zoh9RLRoq/Fj6gXkvdxg==$0 8
BIN$C0999MpPRjGrEnn4tSnBeg==$0 5
BONUS 4
DEPT 3
DEPTT 3
DUMMY_T2 2
EMP 8
EMP1 8
EMP2 8
EMPHIST 8
EMPLOYEES_TEMP 3
TABLE_NAME COUNT(COLUMN_NAME)
EMPPROJ 4
EROW 1
LOGIN 2
PARENT 3
PR 3
SAL 2
SALGRADE 3
T1 1
TEST 3
TSTAMP 1
USERDATA 4
TABLE_NAME COUNT(COLUMN_NAME)
USERDATAUSER 4
VALID_RANGE 13
24 rows selected.
mohammadi
Message was edited by:
Mohdidubai52

Similar Messages

  • Release strategy: Tx CL20N Error: Entry 01 does not exist in table T16FS

    Dear MM Gurus,
    I was designing new release strategy for PR and PO, so I deleted all the previous entries(SPRO) available in SAP. I created my new entries but in the transaction CL20N I got the above mentioned error: "Entry 01 does not exist in table T16FS-Check your entry" . I checked the table T16FS, where the entries were available. It also showed the previous entries I deleted from SPRO.
    Refering the SAP note 365604 (version 29, valid from 08.10.2008), I created the deleted entries again so that I could delete them in the required sequence
    1. release strategies
    2. release indicators
    3. release codes
    4. release groups
    5. class
    After deleting the entries in the above mentioned sequence also I am getting the same error in CL20N.
    I ran report RCCLZUOB, it shows the entries does not exist.
    Please help.
    Edited by: Akshay Kurhe on Mar 2, 2009 6:02 AM

    hi
    check this setting
    Distribution Using Object Classes -->Maintain Class Types & Maintain Classes

  • Position does not exist in table T528

    I have transported from Dev to QAS.
    I am trying to hire an employee using PA40 and when i select position it is giving an error saying does not exist in table T528

    Hello,
    I have created a entire new org. structure in QA including the positions.
    When I am trying to assign the positions I am getting the same error as entry does not exist in table T528B.
    I have checked the table and there are no entires for my positions.
    What I need to do now?
    Kindly reply.
    Thank you

  • Argument does not exist in Table?

    Hi,
    I'm trying to create Planned Independent Requirements using the BAPI_REQUIREMENTS_CREATE.
    Getting the error "Argument does not exist in Table".
    I'm passing the following parameters.
    REQUIREMENTS_ITEM
          MATERIAL    = '000000000000015197'.
          PLANT         = 'ABC1'.
          REQU_TYPE= 'TEST'.
          VERSION    = '00'.
          VERS_ACTIV = 'X'.
          REQ_NUMBER = ''.
    REQUIREMENTS_SCHEDULE_IN
    DATE_TYPE = '2'.
    REQ_DATE  = '20101001'.
    REQ_QTY   =  50.
    PROD_VES  = '0010'.
    REQUIREMENT_PARAM
          STATUS  = ''.
          TRTYP   = 'X'.
          DELKZ   = SPACE.
          SYNCRON = 'X'.
    Did I miss any parameters?
    Why I'm getting this error?
    Thanks
    Thruna

    Ryan,
    Are you passing all the parameters like below?
      SSHDIN-DATE_TYPE = '2'.
      SSHDIN-REQ_DATE  = '20100101'.
      SSHDIN-REQ_QTY   =  100.
      APPEND SSHDIN.
          ITEM-MATERIAL    = '00000000000012345'.
          ITEM-PLANT         = 'ABC1'.
          ITEM-REQU_TYPE  = 'TEST'.
          ITEM-VERSION    = '00'.
          ITEM-VERS_ACTIV = 'X'.
          ITEM-REQ_NUMBER = ''.
          ITEM-MRP-AREA = 'ABC1'.
          PARAM-STATUS  = 'X'.
          PARAM-TRTYP   = 'X'.
          PARAM-DELKZ   = SPACE.
          PARAM-SYNCRON = 'X'.
          CALL FUNCTION 'BAPI_REQUIREMENTS_CREATE'
               EXPORTING
                    REQUIREMENTS_ITEM        = ITEM
                    REQUIREMENT_PARAM        = PARAM
               IMPORTING
                    MATERIAL                 = BAPI_MATNR
                    PLANT                    = BAPI_WERKS
                    REQUIREMENTSTYPE         = BAPI_BEDAE
                    VERSION                  = BAPI_VERSB
                    REQMTSPLANNUMBER         = BAPI_PBDNR
               TABLES
                    REQUIREMENTS_SCHEDULE_IN = SSHDIN
                    RETURN                   = RETURN1
               EXCEPTIONS
                    OTHERS                   = 1.
    Thanks
    Thruna

  • Management Studio 2008 does not refresh after table create / alter

    hello
    Management Studio 2008 does not refresh after table create / alter, why?
    f5 / refresh button does not work in "Object Explorer".... i always need the restart the whole application to see any changes, this is strange...
    regards, jan

    Hi jm,
    I’m writing to follow up with you on this post. Was the problem resolved after performing Vishal ‘s steps? If you are satisfied with our solution, I’d like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings
    or concerns you may have.
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Database Adapter Wizard does not show accessible table

    HI guys,
    in the wizard I am unable to see the tables which I need to use for database adapter.
    But I do have access to those tables, and able to select from them in SQL worksheet from with in Jdev.
    I dont own the tables, but my user id have readable access to those tables.
    Any help is appreciated.
    P.S. If I didnt explain it properly, plz let me know. It really creates lot of access issues if I can only create DB adapter on My owned tables.
    :)

    Hi there,
    please see the answer to your duplicate post on the BPEL forum:
    DB Adapter does not show selectable tables
    In general BPEL forum gets a lot more traffic but I will try to address questions on both equally.
    Thanks
    Steve

  • Calculation in a table

    Hi All- I've the following table "Count"
    Year        Period               Pd Start Dt    Pd End Dt    Count1         Count2      Count 3
    2012    Period 05, 2012    25-APR-12    29-MAY-12    10779455    7557757      0
    2012    Period 06, 2012    30-MAY-12    26-JUN-12    11056981    7750255       0
    2012    Period 07, 2012    27-JUN-12    24-JUL-12    11328596    7940012        0
    2012    Period 08, 2012    25-JUL-12    28-AUG-12    11678538    8182974       0
    2012    Period 09, 2012    29-AUG-12    25-SEP-12    11951574    8372835      0
    2012    Period 10, 2012    26-SEP-12    23-OCT-12    12228481    8567254       0
    2012    Period 11, 2012    24-OCT-12    27-NOV-12    12543681    8789947       0
    2012    Period 12, 2012    28-NOV-12    25-DEC-12    12791420    8964870      0 
    Now I want to do the following calculation on the table Count3= (Count1/Count2)*100. Can someone please help me with the SQL of this? I know this is pretty straight forward but any help is greatly appreciated. Thanks again.

    Hi,
    It sounds like you want this:
    UPDATE  cnt    -- COUNT is not a good table name
    SET     count3  = (count1 / count2) * 100
    or, if you don't want to actually change the table:
    SELECT  year, period, pd_start_dt, pd_end_dt, count1, count2
    ,       (count1 / count2) * 100    AS count3
    FROM    cnt     -- COUNT is not a good table name
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    If you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002

  • How does oracle accesses v$ tables or views in mount state

    Hi All,
    I want to know how oracle accesses fixed tables/views while the database is in mount state.
    I did the following:
    1. Started the database in mount state.
    2. Query v$database ,v$datafile--Successful
    3. Queried dba_data_files.---ERROR
    SQL> select * from dba_data_files;
    select * from dba_data_files
    ERROR at line 1:
    ORA-01219: database not open: queries allowed on fixed tables/views only
    As per my understanding goes,all these tables are a part of Data Dictionary which is stored physically on system tablespace.
    Now since the database is mounted ,it cannot access any part of system tablespace's data.Am I right??
    So how does it queries v$ tables and other fixed database tables in mount state???
    Thanks in advance
    Saket Bansal

    the v$(dynamic) view comes from instance
    the dba(static) views comes from dictionary
    but there is only one view can be look while instance is in nomount mode
    and that is
    v$instance ,,,
    BUT ONLY THING I DON KNOW IS WHY WE CAN STILL DESCRIBE THE V$ VIEWS WHILE INSTANCE IS IN NOMOUNT MODE,,,
    ORACLE instance shut down.
    SQL> startup nomount;
    ORACLE instance started.
    Total System Global Area 285212672 bytes
    Fixed Size 1248576 bytes
    Variable Size 75498176 bytes
    Database Buffers 205520896 bytes
    Redo Buffers 2945024 bytes
    SQL> desc v$datafile;
    Name Null? Type
    FILE# NUMBER
    CREATION_CHANGE# NUMBER
    CREATION_TIME DATE
    TS# NUMBER
    RFILE# NUMBER
    STATUS VARCHAR2(7)
    ENABLED VARCHAR2(10)
    CHECKPOINT_CHANGE# NUMBER
    CHECKPOINT_TIME DATE
    UNRECOVERABLE_CHANGE# NUMBER
    UNRECOVERABLE_TIME DATE
    LAST_CHANGE# NUMBER
    LAST_TIME DATE
    OFFLINE_CHANGE# NUMBER
    ONLINE_CHANGE# NUMBER
    ONLINE_TIME DATE
    BYTES NUMBER
    BLOCKS NUMBER
    CREATE_BYTES NUMBER
    BLOCK_SIZE NUMBER
    NAME VARCHAR2(513)
    PLUGGED_IN NUMBER
    BLOCK1_OFFSET NUMBER
    AUX_NAME VARCHAR2(513)
    FIRST_NONLOGGED_SCN NUMBER
    FIRST_NONLOGGED_TIME DATE
    SQL> desc v$tablespace;
    Name Null? Type
    TS# NUMBER
    NAME VARCHAR2(30)
    INCLUDED_IN_DATABASE_BACKUP VARCHAR2(3)
    BIGFILE VARCHAR2(3)
    FLASHBACK_ON VARCHAR2(3)
    ENCRYPT_IN_BACKUP VARCHAR2(3)
    HOW DOES THIS COME FROM ????
    Edited by: jignesh kankrecha on Jul 6, 2009 8:12 AM

  • Error in formula field: Column 'TASK_BCWP' does not belong to table Task

    Hi,
    We have a formula field to calculate the a cost KPI and that field throws an error in the ULS logs. The error is: PWA:PWA, ServiceApp:Project Server Service Application, User:GDFN\IPL_Content, PSI: SSP: Formula Evaluation Failed! - trying to continue - (System.ArgumentException:
    Column 'TASK_BCWP' does not belong to table Task.
    We are running EPM 2010. Recreating of the custom field did not work. We are not running with the latest CU yet.
    The formula that we use is:
    IIf([BCWP] > 0; [ACWP] / [BCWP]; 1)
    The stack trace from the ULS log is:
    PWA:http://gdfn-ipl-14/PWA, ServiceApp:Project Server Service Application, User:GDFN\IPL_Content, PSI: SSP: Formula Evaluation Failed! - trying to continue - (System.ArgumentException: Column 'TASK_BCWP' does not belong to table Task.
    at System.Data.DataRow.GetDataColumn(String columnName)
    at System.Data.DataRow.get_Item(String columnName)
    at Microsoft.Office.Project.Server.BusinessLayer.FormulaDataProvider.HaveColumn(DataRow row, String columnName)
    at Microsoft.Office.Project.Server.BusinessLayer.FormulaDataProvider.GetTaskData(Guid nodeId, Int32 fieldId)
    at Microsoft.Office.Project.Server.BusinessLayer.FormulaDataProvider.GetDataInternal(Int32 entityId, Guid nodeId, Int32 fieldId, Boolean canChangeEntity)
    at Microsoft.Office.Project.Server.BusinessLayer.FormulaDataProvider.GetData(Int32 entityId, Guid nodeId, Int32 fieldId)
    at Microsoft.Office.Project.Server.BusinessLayer.Formula.FieldExpression.Evaluate(IFieldEvaluator context, Guid nodeId)
    at Microsoft.Office.Project.Server.BusinessLayer.Formula.GreaterExpression.Evaluate(IFieldEvaluator context, Guid nodeId)
    at Microsoft.Office.Project.Server.BusinessLayer.Formula.ConditionalExpression.Evaluate(IFieldEvaluator context, Guid nodeId)
    at Microsoft.Office.Project.Server.BusinessLayer.Formula.FormulaEvaluator.Evaluate(PlatformContext context, Expression formula, Int32 entityId, Int32 fieldId, Guid nodeId, Dictionary`2 entityFormulaFields)) + -- FieldId = 188776525 -- NodeId = 1b1149c1-52c2-4f7f-ba60-6d65effdb6b3
    -- Formula = IIf(Greater([MSPJ188743691], 0), Divide([MSPJ188743800], [MSPJ188743691]), 1)
    I have no clue where to start looking for the cause of this error. Any help would be appreciated.
    Thanks,
    Quint Mouthaan

    Hi Quint,
    This can because of database fragmentation. I would recommend you to re-index the databases and perform a de-fragmentation and can check the behavior.
    On the other hand when you receive this message, you can try an IISRESET and check. Additionally you can use refer to following link for de-fragmenting queries.
    http://support.microsoft.com/kb/943345
    Happy troubleshooting.
    Vikram Daruru - MSFT

  • Windows 2012 : A domain user who does not belong to the Administrators group can change the passwords

    Hello,
    Can a domain user
    that does not belong to the Administrators group,
    be able to change your password ?
    I tried to create a domain user account
    without administrative access. This user account have
    permission to access Windows Server
    2012 via Remote Desktop.
    I tried to access the same account
    to the Active Directory Users and Computers,
    i was amazed, because the user account it can  changed
    the password for multiple accounts,
    included one administrator account.
    Best regards,
    Ricardo

    Hi Ricardo, 
    I agree with Martin, we can check the membership about this user account. Besides, we can refer to following steps to check the memberships:
    Start the ADUC on windows 2012.
    Right-click the user account and select
    Properties, then click the Member Of tab.
    Check which group is the user account belongs to.
    In addition, i suggest you create a new user account, and check if the new account can change other user’s password.
    Best Regards,
    Erin

  • How does one update Std Table EDIPHONE(there is no Table Maintainance)?

    How does one update Std Table EDIPHONE(there is no Table Maintainance)?
    Regards,
    Shashank.

    You should not update the standard database table directly.
    through the partner profile tcode: WE20 you can update the table EDIPHONE.
    u can choose required partner profile in the WE20, select the tab 'Telephony', and update the data, the table EDIPHONE will get updated.
    if you want to maintain this edi phone data for a particular message type/s then select inbound/output parameters and double clikc on it, go to last tab in teh screen 'Telephony',  and updated the required data.

  • What does "AMS" mean in table  AMS.AMS_CAMPAIGNS_ALL_B

    what does "AMS" mean in table AMS.AMS_CAMPAIGNS_ALL_B

    Hi,
    AMS is simply the preffix of the Marketing module in the E-Business Suite. So, all the tables in that module should start by AMS. I think it stands for Analytical Marketing System.
    Regards.

  • The query does not reference any table when attempting to build the WHERE clause.  (IES 00022)

    Hi
    I am getting below error.
    The query does not reference any table when attempting to build the WHERE clause.  (IES 00022)
    This error is in Validating Measue object in IDT.
    It is not throwing error for dimensions objects but only for measure objects.
    My BO version is 4.1
    Backend is Teradata 14.1.
    Regards
    Gaurav.

    Hi
    In the dimension/Measure definition, you can select the table. Find the below screenshot.
    If you still getting the issue…Can you please share your screenshot, for better understanding the issue?

  • Entry DE  does not exist in table T005E

    Dear all
    I create Plan ( module PP ) when i input values in field Country " DE "  is error . " Entry DE does not exist in table T005E " .Plz help me
      Thanks and Regard ,
       Lan nguyen

    Dear,
    Please check the entry of DE
    In SPRO -> SAP NetWeaver-> General Settings-> Set Countries-> Insert Regions
    In this table we maintain the regions for the Country.
    Please refer the OSS Notes : 107588, 122292, 161359
    Regards,
    R.Brahmankar

  • Net Weight (NTGEW) does not populate in table VBRP and LIPS for Purch Order

    The net weight field (NTGEW) does not populate in tables VBRP and LIPS when created from a Purchase Order.  The field Net Weight (NTGEW) does populate when created from a sales order.  Do you know if there is a way to make the field populate when created from a Purchase order?
    Thanks,
    Ta

    Hi,
    Ta
    In Material master Basic Data tab 1, you have to maintain Gross wgt and net weight. then when you creating purchase order, The Item level, Additional data tab you will able see Gross and net wgt.
    I hope solved your problem.
    Regards....
    Sanjeev

Maybe you are looking for