Any one help me about my query

select
count(*) as "total",
to_char(ea.revdt,'Mon') as "month",
prog.pro_code,
(sum(ea.amtapprop) / ea.amtapprop) as "totalAmount"
from csris_ea_m ea
join csris_progmon_m prog on ea.progmonid=prog.progmonid
group by to_char(ea.revdt,'Mon'), prog.pro_code

Hi,
in your query:
SELECT   COUNT(*) AS "total",
         TO_CHAR(ea.revdt, 'Mon') AS "month",
         prog.pro_code,
         (  SUM(ea.amtapprop)
          / ea.amtapprop) AS "totalAmount"
FROM     csris_ea_m ea JOIN csris_progmon_m prog ON ea.progmonid = prog.progmonid
GROUP BY TO_CHAR(ea.revdt, 'Mon'),
         prog.pro_codesince you have a group by, you cannot an expression like "SUM(ea.amtapprop)/ ea.amtapprop)" (a grouping column wihtin a non grouping expression)
You can do your query in 2 steps:
WITH q1 AS
     (SELECT TO_CHAR(ea.revdt, 'Mon') AS MONTH,
             prog.pro_code,
             ea.amtapprop
      FROM   csris_ea_m ea JOIN csris_progmon_m prog ON ea.progmonid = prog.progmonid
     q2 AS
     (SELECT   COUNT(*) total,
               MONTH,
               pro_code,
               SUM(ea.amtapprop)
      FROM     q1
      GROUP BY TO_CHAR(ea.revdt, 'Mon'),
               prog.pro_code)
SELECT q1.*,
       total,
         total
       / q1.amtapprop
FROM   q1,
       q2
WHERE  q1.MONTH = q2.MONTH
AND    q1.pro_code = q2.pro_codeor use an analytic function:
with t as
(select 1 c1,1 c2 from dual union all
select 1 c1,2 c2 from dual union all
select 1 c1,3 c2 from dual union all
select 3 c1,10 c2 from dual union all
select 2 c1,8 c2 from dual union all
select 2 c1,4 c2 from dual)
SELECT c1,
       c2,
       SUM(c2) OVER(PARTITION BY c1) tot,
         SUM(c2) OVER(PARTITION BY c1)
       / c2 div
FROM   t
C1     C2     TOT     DIV
1     1     6     6
1     2     6     3
1     3     6     2
2     8     12     1.5
2     4     12     3
3     10     10     1Edited by: user11268895 on Aug 25, 2010 1:25 PM

Similar Messages

  • Quetion could any one help me about a count

    as I can inside make a sum of registries of a special column in
    form. and that tigger is the one that I must use within same
    form.
    thanks

    1)i what to send an email from my application can u tell how plz
    in deatails if u can.
    Please refer Note:47498.1 in Metalink, which explains Sending a
    Fax/Email via Microsoft Exchange.
    2)i what to dial a telephone number from amy application plz
    tell me howHope the above note gives you some idea on this.
    3)can we send the window or the canvas as a parametre to a
    procedure I am not clear about your requirement, if you want to pass the
    window name or canvas name as a parameter to a procedure, it is
    possible, just pass the name of the object as parameter.
    Depending on the object type, i.e., window / canvas, do the
    appropriate action in your procedure.
    Hope the above helps,
    Ganesan

  • Please any one help me in this query

    i have 6 tables. in my object i have to transfer the data to the internal table i_vbrk. it must include the following fields from the respective fields
    vbrk   -  vbeln, vkorg, vtweg, fkdat,knumv
    vbrp   -  vbeln, matnr, aktnr, arktx, netwr, wavwr
    mara   -  matnr, extwg, matkl
    marc   -  matnr, mmsta
    marm   -  umrez, matnr
    konv   -  knumv, kschl, kposn, kbetr.
    please help me in joining the tables to one internal table

    Hi,
    data:begin of it_vbrk occurs 0,
    vbeln like vbrk-vbeln,
    vkorg like vbrk-vkorg,
    vtweg like vbrk-vtweg,
    fkdat like vbrk-fkdat,
    knumv like vbrk-knumv,
    end of it_vbrk.
    data:begin of it_vbrp occurs 0,
    vbeln like vbrp-vbeln,
    matnr like vbrp-matnr,
    aktnr like vbrp-aktnr,
    arktx like vbrp-arktx,
    netwr like vbrp-netwr,
    wavwr like vbrp-wavwr,
    end of it_vbrp.
    data:begin of it_mara occurs 0,
    matnr like mara-matnr,
    extwg like mara-extwg,
    matkl like mara-matkl,
    end of it_mara.
    data:begin of it_marc occurs 0,
    matnr like marc-matnr,
    mmsta like marc-mmsta,
    end of it_marc.
    data:begin of it_marm occurs 0,
    umrez like marm-umrez,
    matnr like marm-matnr,
    end of it_marm.
    data:begin of it_konv occurs 0,
    knumv like konv-knumv,
    kschl like konv-kschl,
    kposn like konv-kposn,
    kbetr like konv-kbetr,
    end of it_konv.
    select vbeln vkorg vtweg fkdat knumv
    from vbrk
    into table it_vbrk.
    select vbeln matnr aktnr arktx netwr wavwr
    from vbrp
    into table it_vbrp
    for all entries in it_vbrk
    where vbeln = it_vbrk-vbeln.
    select matnr extwg matkl
    from mara
    into table it_mara
    for all entries in it_vbrp
    where matnr = it_vbrp-matnr.
    select matnr mmsta
    from marc
    into table it_marc
    for all entries in it_mara
    where matnr = it_mara-matnr.
    select umrez matnr
    from marm
    into table it_marm
    for all entries in it_mara
    where matnr = it_mara-matnr.
    select knumv kschl kposn kbetr
    from konv
    into table it_konv
    for all entries in it_vbrk
    where knumv = it_vbrk-knumv.
    regards,
    sowjanya.

  • HT204023 hi there can any one help me i have a iphone 5 but my mobile internet not working but i can connect to my wifi no bother

    hi there can any one help me i have a iphone 5 but my mobile data is not working but a can connect to my wifi no bother

    talk to your carrier about the data subscription and possible settings changes to their apn than

  • Please help i started my project video format 720HD resolution 12x720 rate 25p at last when i finish and burn to dvd the edges are cut off any one help please i am really in trouble

    please help i started my project with  video format 720HD, resolution 12x720, rate 25p.  at last when i finish and burn to dvd the edges are cut off and my logo cut off the screeen aswell any one help please i am really in trouble. thanks

    Sorry, but I don't know anything about that app.
    I did go to their Web site and I see they have a support link. Perhaps you can get help there or in their forum.
    If you are OK with a DVD with a basic menu, you could try the Share>DVD option in FCP.
    Good luck.
    Russ

  • Hello i am having a problem in my 4s that it dosent run any USSD code it goes on calling , can any one help me i am mack from Karachi Pakistan

    Hello i am having a problem in my 4s that it dosent run any USSD code it goes on calling , can any one help me i am maqsood  from Karachi Pakistan

    Ok so I've done what you said and this is what it's come back ....
    I don't know that these are the errors , but they're the things which don't look right ...
    Throughout the shut down there is a recurring line ;
    It says ;
    Com.apple.launchd 1 0x100600e70.anonymous.unmount 301 PID still valid
    Then there are 2 more which I think are related ;
    Com.apple.securityd 29 PID job has I overstayed its welcome , forcing removal.
    Then the same with fseventd 48 and diskarbitrationd 13
    Oh and on Launchd1 : System : stray anonymous job at shut down : PID 301 PPID13 PGID 13 unmount...
    Then the last process says "about to call: reboot (RB_AUTOBOOT).
    Continuing...
    And stops ...
    Hope this means something to you ... Thanks again for your help so far :-)

  • Hi gurus, can any one explain me about patches in SAP?

    Hi gurus,
    Can any one explain me about patches in SAP?
    Regards
    Raghu

    Hi Raghu,
    If you do bit of googleing you will get information.
    http://help.sap.com/saphelp_smehp1/helpdata/en/30/1fea80d9b44f5a88fc0038d3dabb76/content.htm
    http://help.sap.com/saphelp_smehp1/helpdata/en/57/4e0eb0eae6457ea69b509813048989/content.htm
    http://help.sap.com/saphelp_nwce10/helpdata/en/a8/02784278b66255e10000000a155106/content.htm
    http://www.saptechies.com/support-package-stack-guide-sap-netweaver-70/
    http://www.sapdev.co.uk/upgrade/sap-patching.htm
    http://www.erpgreat.com/basis/sap-patch-administration.htm
    Regards,
    Deepanshu Sharma

  • Can any one explain me about Field symbols in Genral Reports?

    Can any one explain me about Field symbols in Genral Reports?
    If possible, plz explain me with the code to explain me about the field symbols.
    Regards,
    Krishna Chaitanya

    Syntax
    FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
    Extras:
    1. ... typing
    2. ... STRUCTURE struc DEFAULT dobj
    Effect
    The FIELD-SYMBOLS statement declares a field symbol <fs>. The naming conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
    After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
    Addition 1
    ... typing
    Effect
    You can use the addition typing to type the field symbol. The syntax of typing is described under Syntax of Typing. The typing specifies which memory areas can be assigned to the field symbol (see Checking the Typing) and in which operand positions it can be used.
    Note
    You can omit the addition typing outside of methods. In this case, the field symbol has the complete generic type any and is implicitly assigned the predefined constant space during the declaration.
    Addition 2
    ... STRUCTURE struc DEFAULT dobj
    Effect
    If you specify the addition STRUCTURE instead of typing for a field symbol, and struc is a local program structure (a data object, not a data type) or a flat structure from the ABAP Dictionary, this structure is cast for the field symbol <fs>. You have to specify a data object dobj that is initially assigned to the field symbol.
    The field symbol copies the technical attributes of structure struc as if it were completely typed. When you assign a data object using the addition DEFAULT, or later using ASSIGN, its complete data type is not checked in non- Unicode programs. Instead, the system merely checks whether it has at least the length of the structure and its alignment.
    In Unicode programs, we differentiate between structured and elementary data objects. For a structured data object dobj, its Unicode fragment view has to match the one of struc. In the case of an elementary data object, the object must be character-type and flat, and struc must be purely character-type. The same applies to assignments of data objects to field symbols typed using STRUCTURE when using the ASSIGN statement.
    Note
    Field symbols declared using the addition STRUCTURE are a mixture of typed field symbols and a utility for casting structured data types. You should use the additions TYPE or LIKE for the FIELD-SYMBOLS statement to type field symbols, while the addition CASTING of the ASSIGN statement is used for casting.
    Example
    The first example shows the obsolete usage of the addition STRUCTURE.
    DATA wa1 TYPE c LENGTH 512.
    FIELD-SYMBOLS <scarr1> STRUCTURE scarr DEFAULT wa1.
    <scarr1>-carrid = '...'.
    The second example shows the replacement of STRUCTURE with the additions TYPE and CASTING.
    DATA wa2 TYPE c LENGTH 512.
    FIELD-SYMBOLS <scarr2> TYPE scarr.
    ASSIGN wa2 TO <scarr2> CASTING.
    <scarr2>-carrid = '...'.
    Also,
    Field Symbols
    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
    Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
    All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
    Field symbols provide greater flexibility when you address data objects:
    If you want to process sections of fields, you can specify the offset and length of the field dynamically.
    You can assign one field symbol to another, which allows you to address parts of fields.
    Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    You can also force a field symbol to take different technical attributes from those of the field assigned to it.
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    check the below links u will get the answers for your questions
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
    Syntax Diagram
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Extras:
    1. ... TYPE type
    2. ... TYPE REF TO cif
    3. ... TYPE REF TO DATA
    4. ... TYPE LINE OF type
    5. ... LIKE s
    6. ... LIKE LINE OF s
    7. ... TYPE tabkind
    8. ... STRUCTURE s DEFAULT wa
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
    Effect
    This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
    You can only use one of the additions.
    Example
    Output aircraft type from the table SFLIGHT using a field symbol:
    FIELD-SYMBOLS <PT> TYPE ANY.
    DATA SFLIGHT_WA TYPE SFLIGHT.
    ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... TYPE type
    Addition 2
    ... TYPE REF TO cif
    Addition 3
    ... TYPE REF TO DATA
    Addition 4
    ... TYPE LINE OF type
    Addition 5
    ... LIKE s
    Addition 6
    ... LIKE LINE OF s
    Addition 7
    ... TYPE tabkind
    Effect
    You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
    This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
    The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
    Example
    Address components of the flight bookings table SBOOK using a field symbol:
    DATA SBOOK_WA LIKE SBOOK.
    FIELD-SYMBOLS <SB> STRUCTURE SBOOK
    DEFAULT SBOOK_WA.
    WRITE: <SB>-BOOKID, <SB>-FLDATE.
    Related
    ASSIGN, DATA
    Additional help
    Declaring Field Symbols

  • Part cost   kf values are getting aggregated ......... can any one help me?

    hello gurus....
    iam designing a infocube in which there is a keyfigure 'partcost'.when i execute a query on this infocube, the part cost values  for a particular part id are getting summed up. but the part cost ,whether for single or 100's of parts ,should be the same.
       i dont want these part cost values in the query to be aggregated.  what i should do now. declare this part cost as non cumulative kf or is there any solution for this ?
      i have gone thru the sap help site, but unable to find a solution for this?
       how to declare it as a non cumulative kf ?
      can any one suggest me a with some detailed steps what should be done for this? very urgent . my project deadline is with in 2 days. i will be really thankful to u..

    Hi Lokesh,
          Pls check your post in BI General. part cost  kf values are getting aggregated ......... can any one help me?
    Regards
    Hari
    Message was edited by: Hari Krishnan K

  • Any one help me meta trader 4 download and install my ibook g4 10.4.11

    any one help me download  and install meta trader my ibook 10.4.11 i try for this pls help me i an tired for this

    Though I am not familiar with MetaTrader 4, I do know it would require a virtualization
    application to run Windows in a Mac, (such as Virtual PC for Mac) & a copy of Windows
    appropriate for both the correct version of PC virtualization, and both versions of the
    Virtual PC (or equivalent) and Windows that could run in the computer you have...
    Within the hardware limitations, and the system limitations of co-sharing the virtual PC
    software, windows, and MetaTrader4 together.
    From what I've read, most users have a later model Intel-based Mac computer, with at
    least a core2duo cpu, and 4GB+ RAM or more, so the virtual system and OS X can both
    work; plus a additional resources for the application to run on top of this.
    I'd tend to believe you will not have a good day or any kind of fair results running the
    MetaTrader4 application on a Mac capable of running Mac OS X 10.4.11 Tiger, as it
    would be slow. And you will have to buy a copy of Virtual PC for Mac that could run
    under Tiger OS X 10.4.11, and a version of Windows that can run with both the above.
    Here is a discussion forum link from a MetaTrader thread; appears the Intel-based Mac
    with extra RAM, virtual PC software, with Windows installed too, running on Tiger 10.4.11
    could be a low-end marginal access point to use the MetaTrader, made for Windows PC.
    This discussion is from 2007 to 2008, and so the results even if the software were to function
    may vary now from what they found then, not just on the Mac side, but on the Windows PC
    side of all this. http://www.metatrader4.com/forum/3228
    Another discussion about virtual PC and metatrader4
    http://www.metatrader4.com/forum/395
    Some show they ran windows XP, some with Parallels in a Core2Duo Intel-Mac, some
    used BootCamp to set up the partition in the Mac HDD so windows could be installed;
    so that is another world from an older iBook G4 (PowerPC-Mac) that has a single core
    PPC processor & limited hardware, a marginal situation for Mac OS X by itself, at times.
    I cannot recommend running MetaTrader4 on an iBook G4 under Tiger 10.4.11, with
    Virtual PC for Mac, so a Windows OS can be used. I doubt the configuration can do it.
    However I am not an expert in this matter, but I do have several older PPC pre-intel Macs
    and know they have/had limitations, especially when one hopes to run Windows on them
    via a Virtualization setup. IT would be super SLOW!
    If you had an Intel-based Mac running at least OS X 10.6.8 & enough RAM, etc there is
    this retail product: http://www.xm.com/metatrader-mac that I just read about...
    Good luck in this matter...!

  • Can not down load new i tunes up date says old bonjour can not be removed seek advice i tunes is nothing but a pain can any one help

    can not down load i tunes up date because old bonjour can not be removed can any one help
    because apple must know about this problem but are not help full

    I would try uninstalling all of the Apple software and then reinstalling it using these instructions:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    You migh want to try doing this when in safe mode.

  • Can any one help? "Windows cannot repair this computer automatically."

    I have a laptop satellite L455-S5000.
    And when I try and trun on my computer a black screen comes on that says "windows is loading files..."
    and after it loads a window pops up saying "startup repair is checking your computer for problems..."
    and after that gets done it says "Windows cannot repair this computer automatically" so I click "Send information about this problem (recommended)" and then I click "finish" then it shuts down. when I try turning it back on it does the same thing over. Please can any one help me fix it? Im really clueless about computers and I have know Idea what is wrong with it, or how to even go about fixing it. thanks.

    _Ashley_
    Turn the laptop off, hold down F8, turn the laptop on and let go of F8 when you see the Advanced Boot Options.
    In here, choose Repair Your Computer then press enter, follow the prompts, choose System Restore and restore your laptop to a point before the problems started.
    If the laptop cant get you there, a system recovery starts the laptop from it's factory state but you loose your programs and files doing that. Holding the "0" beside "9" while you turn the laptop on boots the laptop from its recovery partition if you accept data loss.

  • Wifi and bluetooth hardware missing in my ipod touch could any one help me to fix it?

    wifi and bluetooth hardware missing in my ipod touch could any one help me to fix it?

    If the following is your problem try the troubleshooting described within:
    iOS: Wi-Fi or Bluetooth settings grayed out or dim
    Frequently it is due to  hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    If that is not your problem then we need more information about hur problem. How do you know the"hardware" is missing?

  • Any one help me..? working with scrollbar @ widget...

    hi!
    any one help me? how to create a scrollbar in widget. thanks in advance.
    -yajiv

    Hi Sai,
    SRM210 and SRM Cook book will help you a lot in configuring the various scenarios.
    Also look at Service market place for more information about upgrades and Ramp up knowledge transfer
    https://websmp101.sap-ag.de/rkt
    Rgds,
    Teja

  • Hello everyone, can any one help regarding activation

    i have got iphone 4s, i factory unlocked my iphone 4s, but now when ever i put any sim apart from the orignal SIM,it goes on to activation required, then it says Sim not valid , though i get the signal bars at the top, and carrier in SETTINGS->GENERAL->ABOUT-> also changed from orignal carrier to new. I dont know what to do, Can any one help me, i have paid for the factory unlocking to a guy and now that guy is not picking my phone, i dont know what to do.

    Ask him... he is not the carrier. ONLY the carrier can authorize unlocking it. There is a process that has to be followed involving restoring the phone after the unlock has been approved. If the phone was hacked at any time prior to requesting a legitimate unlock, it may not be usable at all after attempting to have it legitimately unlocked.

Maybe you are looking for