Grouping splits results

Hello, I have a problem with grouping some data:
SELECT
pas_code,
pas_profile,
count(sutp_id),
sum(sutp_price),
(sutp_price_proc * count(sutp_id) * pbk_price / 100) x
FROM
[...tables and inner joins...]
WHERE
lelele
GROUP BY
pas_code,
pas_profile,
sutp_price_proc,
pbk_priceAnd the problem is, that when i use sutp_price_proc and pbk_price in grouping, it splits my results by those rows. If i delete them from grouping, sql gives me error about not a single grouping in line 1.
pas_code     pas_profile     sutp_id          sutp_price     x
2664          good stuff     3          100          69          < because pbk_price is like 67 from that period
2664          good stuff     3          100          71          < because pbk_price is like 50 from other period Any ideas, how to get all results in a single line like:
pas_code     pas_profile     sutp_id          sutp_price     x
2664          good stuff     6          200          140Edited by: user613795 on 2013.6.6 00.44

with data (pas_code,     pas_profile,     sutp_id,          sutp_price,     x) as
select 2664,'good stuff',     3,          100,          69     from dual union all     
select 2664          ,'good stuff',     3     ,     100,          71 from dual
) select pas_code,     pas_profile,     sum(sutp_id),          sum(sutp_price),     sum(x) from data group by pas_code,     pas_profile;
Output:
pas_code                     pas_profile            sutp_id               sutp_price                      x
2664          good stuff               6          200          140

Similar Messages

  • PO Group/Split by Account Assignment

    Is there a possibility to split/group Purchase Orders that would be created directly from the 'Process Purchase Order' transaction? I thought of using the Group_Local_PO BADi, but it would be called only while creating Purchase Orders from the sourcing cockpit.
    We would like to group/split POs based on the fund and/or some account assignment fields of the line items.
    I could achieve this while PO creation from the sourcing cockpit, but not sure how to handle the automatic PO creation and direct PO creation. Your help is much expected and appreciated. We are on SRM 5.
    Thanks,
    - J

    Hello Jack,
    Jack Lancelot wrote:
    I've implemented exactly the same logic that you had mentioned for PO creation from sourcing cockpit.
    Will this take care of splitting the Shopping cart if POs are to be created against a relevant contract?
    fields AGREEMENT and AGMT_ITEM from Importing parameter ITEM_DATA should answer to your need.
    Splitting criteria are defined in Class Interface CL_BBP_SC_TRANSFER:
    - for local PO, in method SPLIT_PO_LOC_MAP_CRITERIA,
    - for backend PO, in method SPLIT_PO_BE_MAP_CRITERIA.
    Jack Lancelot wrote:
    And for direct PO creation, I have created a validation in Doc Check & save BADi s to give an error message if multiple funds are found. But, I'm not sure if the users would like it.
    Is there a way that I could manipulate this process using the 'Create PO' function module or by any other means?
    I'm weighing the effort that would be required for a custom work around solution.
    Don't know: make your own tests.
    Regards.
    Laurent.

  • "group by" resulting in 'invalid number' error

    Hi,
    I have following query:
    SELECT from_locn from  appwms.PROD_TRKG_TRAN ptt 
    join
    (select locn_id,locn_brcd from appwms.locn_hdr where locn_brcd like '60-001-%') locn on locn.locn_id=ptt.from_locn
    where  ptt.TRAN_TYPE = 500
    This runs fine and displays results as below:
    FROM_LOCN
    0000317
    0000319
    0000319
    0000319
    0000319
    Now, adding a group clause results in error:
    SELECT from_locn from  appwms.PROD_TRKG_TRAN ptt 
    join
    (select locn_id,locn_brcd from appwms.locn_hdr where locn_brcd like '60-001-%') locn on locn.locn_id=ptt.from_locn
    where  ptt.TRAN_TYPE = 500
    group by from_locn
    ORA-01722: invalid number
    01722. 00000 -  "invalid number"
    *Cause:   
    *Action:
    Kindly let me know what I am missing here

    Hi,
    I don't see any obvious mistakes.
    Whenever you have a problem, post enough so that the people who want to help you can re-create the problem and test their ideas.  Include 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.Make sure the error occurs with the sample data you post.
    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

  • How to digit grouping in result grid?

    Hello Community & SQL Dev team,
    Asking on behalf of my workmate :)
    ===================
    Does anyone know to enable digit grouping in result grid?
    Display: 999,999,999
    Instead off: 999999999
    ===================
    Yury

    Thanks Barry, the feature request has been submitted:
    https://apex.oracle.com/pls/apex/f?p=43135:7:10812276646823::NO:RP,7:P7_ID:36181
    Forum members: visit the link and vote for the feature if you would find it useful.
    Cheers!
    Marc

  • Group by result in query

    how can i see the group by result in a query means show result also in groups i hope u guys understand wat i meann

    Mushy wrote:
    how can i see the group by result in a query means show result also in groups i hope u guys understand wat i meannJust select the GROUP BY columns. Not sure what you are exactly looking for. Lets say you have a table of employee and you want count of employee on each department you can do this
    SELECT deptno, count(*) FROM emp GROUP BY deptnoHere i have selected deptno and grouped by deptno.
    Is this what you are looking for?

  • Group Policy Results wizard on Windows 8.1

    I am using the Group Policy Management console on Windows 8.1.  When I run the Group Policy Results wizard and target a computer running Windows Server 2003, I get the following error in the Details and Summary tabs: "An error occurred while generating
    report: There are no more endpoints available from the endpoint mapper".
    This only happens if I target a Server 2003 computer.  If I target Windows XP (and up) or Server 2008 (and up), it works fine.
    I tried running the wizard from a Server 2012 and a Server 2012 R2 computer and I receive the same error. If I run the wizard from other versions of Windows/GPMC, I can target those Server 2003 computers just fine.
    Also, the GPRESULT tool works from Windows 8.1 when I target a Server 2003 computer.
    Is Server 2003 no longer supported by the GP Results wizard or is something else messed up?  Web searches for that error just come up with things relating to Active Directory replication, Windows firewall, or the RPC locator service.

    > "An error occurred while generating report: There are no more endpoints
    > available from the endpoint mapper".
    Are server and client in the same network? If not: Double check ALL
    intermediate firewalls... I remember such a problem with a TMG between
    server and client, but I don't know the exact resolution - another
    member of the team reconfigured the TMG.
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • Group Policy Results Error

    Hello
    When i want to get Group policy Results for one Computer in Domain came out this error: (Environment win2k8 and win7)

    Hi Amir,
    >>When i want to get Group policy Results for one Computer in Domain came out this error
    Before going further, we can try to run command gpresult/h gpreport.html
    with admin privileges on the computer to see if we can successfully collect group policy result.
    Best regards,
    Frank Shen

  • FEP Desktop Policies not compatible with GPMC Group Policy Results

    Hello,
    After aplying FEP default desktop policy I am not able to see Group Policy Results - policies for that computer.
    I get this error:
    The following errors were encountered: Registry value "%windir%\SoftwareDistribution\Datastore\Logs\Res*.jrs" is of unexpected type.
    This is a standard exclusion in the installed FEP policy.
    You can see only this error and nothing more. Sometimes it is another error mostly over registry value 2 or 3 or 4. It depens although the policy does not change.
    I tested it by deleting all other policies from that OU. The only one Default Desktop policy was linked to it.
    Also without FEP policy applied it workd as expected.
    Is this a known issue?

    Hello,
    After aplying FEP default desktop policy I am not able to see Group Policy Results - policies for that computer.
    I get this error:
    The following errors were encountered: Registry value "%windir%\SoftwareDistribution\Datastore\Logs\Res*.jrs" is of unexpected type.
    This is a standard exclusion in the installed FEP policy.
    You can see only this error and nothing more. Sometimes it is another error mostly over registry value 2 or 3 or 4. It depens although the policy does not change.
    I tested it by deleting all other policies from that OU. The only one Default Desktop policy was linked to it.
    Also without FEP policy applied it workd as expected.
    Is this a known issue?
    It's still a problem.  No-one has fixed it.
    -=Chris

  • Transaction of item with cost-group 2008 results in cost-group comingle

    Hi Folks,
    I have the following error on Miscellaneous Transaction when I use a different cost group than the default one assign on subinventory:
    Transaction of item with cost-group 2008 results in cost-group comingle
    In our specific case, we define a CONVERSION subinventory with default Cost Group is X
    We would like to create Miscellaneous Transactions (interface table) which use CONVERSION subinventory with different Cost Group.
    The problem is when we use a Cost Group other than X, the "comingle" error occured.
    Is there a manner to create a Miscellaneous Transactions base on a Cost Group different than the default define in the subinventory?
    Regards

    HI,
    is not that type of error.
    Actually there is no error. the system is working as it should.
    I have used different cost groups in subinventories.
    I need a way to change the cost group for some of the items.
    I found some workaround in article 837816.1 but i'm not able to follow it.
    Pls,
    help with procedure to follow.
    Thank you in advance,
    Denis

  • Transaction of item with cost-group 2614 results incost-group comingle

    Hi,
    I'm working on EBS 11i.
    I have setup inv organization and wms is enabled.
    When i'm trying to make transactions betwwen suborganizations there is an
    error message for some type pf items:
    Transaction of item with cost-group 2614 results in cost group comingle.
    I see that for some item, in On hand quanitity form are grouped in different cost groups.
    There is a way to change the cost group of those items, or to make this cost group disabled.
    In this organization I do not care about cost and account. (It is just needed to have physical count of items)
    Pls advice how to solve?
    Thank you in advance,
    Denis

    HI,
    is not that type of error.
    Actually there is no error. the system is working as it should.
    I have used different cost groups in subinventories.
    I need a way to change the cost group for some of the items.
    I found some workaround in article 837816.1 but i'm not able to follow it.
    Pls,
    help with procedure to follow.
    Thank you in advance,
    Denis

  • Assign ID to every group of result

    Hi all,
    I have this problem to assign serial ID to every group of result for my SQL. Let say if I want to group date for 11 data and my result returned 5 groups of date. Is there any way I can create a SQL statement that can assign ID for each group of date without using 'GROUP BY'? Using example count() over total maybe?

    Use DENSE_RANK analytic function
    with c as
    select sysdate DT,1 ID,'VAL1'  VAL FROM DUAL UNION ALL
    select sysdate DT,2 ID,'VAL2'  VAL FROM DUAL UNION ALL
    select sysdate DT,3 ID,'VAL3'  VAL FROM DUAL UNION ALL
    select sysdate-2 DT,4 ID,'VAL4'  VAL FROM DUAL UNION ALL
    select sysdate-2 DT,5 ID,'VAL5'  VAL FROM DUAL UNION ALL
    select sysdate-4 DT,6 ID,'VAL7'  VAL FROM DUAL UNION ALL
    select sysdate-4 DT,7 ID,'VAL6'  VAL FROM DUAL UNION ALL
    select sysdate-4 DT,8 ID,'VAL8'  VAL FROM DUAL UNION ALL
    select sysdate-5 DT,9 ID,'VAL9'  VAL FROM DUAL )
    SELECT DENSE_RANK() OVER (ORDER BY TRUNC(DT) DESC ) RN, DT,ID,VAL
    FROM C
            RN DT                ID VAL
             1 13-AUG-10          1 VAL1
             1 13-AUG-10          2 VAL2
             1 13-AUG-10          3 VAL3
             2 11-AUG-10          4 VAL4
             2 11-AUG-10          5 VAL5
             3 09-AUG-10          6 VAL7
             3 09-AUG-10          7 VAL6
             3 09-AUG-10          8 VAL8
             4 08-AUG-10          9 VAL9
    9 rows selected.

  • [svn] 3243: DataGroup/Group split work.

    Revision: 3243
    Author: [email protected]
    Date: 2008-09-17 09:14:14 -0700 (Wed, 17 Sep 2008)
    Log Message:
    DataGroup/Group split work. DataGroup is for holding data items that may require item rendering. Group only holds visual items now. The Group APIs stay the same (numItems, addItem, etc...). DataGroup uses the IList APIs through its dataProvider. So the equivalent methods are now dataProvider.length, dataProvider, addItem, etc... This is just the initial split work as there's more to come to get the files up to spec. We will also have to visit how we deal with graphic elements in DataGroup vs. Group. For now the implementations are roughly the same.
    QE: Yes - tests may break. please update them.
    Doc: Yes
    Bugs: -
    Reviewer: Glenn
    Modified Paths:
    flex/sdk/trunk/development/eclipse/flex/flex4test/src/flex4test.mxml
    flex/sdk/trunk/frameworks/gumbo-manifest.xml
    flex/sdk/trunk/frameworks/mxml-2009-manifest.xml
    flex/sdk/trunk/frameworks/projects/flex4/defaults.css
    flex/sdk/trunk/frameworks/projects/flex4/manifest.xml
    flex/sdk/trunk/frameworks/projects/flex4/src/Flex4Classes.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/ItemsComponent.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/List.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/Selector.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/core/Group.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/events/FlexEvent.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/Graphic.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/intf/ILayout.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/layout/BasicLayout.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/layout/HorizontalLayout.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/layout/VerticalLayout.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/ListSkin.mxml
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/PanelSkin.mxml
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/SelectorSkin.mxml
    Added Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/component/DataComponent.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/core/DataGroup.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/core/GroupBase.as
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/ComplexPanelSkin.mxml
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/skin/DataComponentSkin.mxml

    Running the script by python2 solves it for me:
    su - mythtv -c "nice -n 19 python2 /usr/bin/tv_grab_nl_py --output ~/listings.xml"
    Best regards,
    Cedric

  • Problems with splitting result into different rows. Group by-issue?

    Hi all!
    I have a table that looks a bit like this:
    Pallet          Status          Number          Time
    A          MoveIn          48          11:11
    A          Pick          -1          11:11
    A          Pick          -1          11:12
    A          Pick          -1          11:12
    A          MoveOut     45          11:13
    A          MoveIn          45          18:20
    A          Pick          -1          18:23
    A          Pick          -1          18:23
    A          Pick          -1          18:23
    A          Pick          -1          18:24
    A          MoveOut     41          18:25
    A          MoveIn          41          21:31
    A          Pick          -1          21:55
    .....This is logging pallets that is moved to one station and then number of boxes are picked off. (For making it more simple, I only show one pallet in above example.)
    I would like to present the result with one row for each time the pallet have been at the station, like:
    Pallet          Picked          Time
    A          3          11:11
    A          5          18:20
    A          ....          .....This means that the same pallet might be showned on several rows, as it has been to the station several times. I have tried several different "GROUP BY" but I cannot make it work.
    For example I have tried to group by hour, but this fails if a pallet is moved twice per hour or if boxes are picket at different hours (eg, first box picked 09:59, last box 10:01)
    Does anyone have a suggestion how to solve this?
    Thanks in advance and Kind regards / Anders from Sweden

    Hej, Anders,
    Can you explain what defines a group?
    It looks like you're saying that a group is a sub-set of a pallet. If we arrange all the rows for a pallet in order by time, then a new group will start every time we have a row where status='MoveIn'. That is, a group consists of a row with status='MoveIn', and all the rows immediately following it, in order by time, up to, but not including, the next row with status=-'MoveIn'. Is that right?
    If so, you can use the analytic COUNT (or SUM) function to find out how many rows with status='MoveIn' have already occurred, in order by time, like this:
    WITH     got_grp          AS
         SELECT     pallet, status, time
         ,     COUNT ( CASE
                             WHEN  status = 'MoveIn'
                       THEN  1
                         END
                    ) OVER ( PARTITION BY  pallet
                                ORDER BY          time
                        )           AS grp
         FROM    table_x
    SELECT       pallet
    ,       COUNT ( CASE
                      WHEN  status = 'Pick'
                    THEN  1
                  END
                )          AS picked
    ,       MIN (time)          AS start_time
    FROM       got_grp
    GROUP BY  pallet
    ,            grp
    ORDER BY  pallet
    ,            grp
    ;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
    This assumes that the combination (pallet, time) is unique. Your sample data includes:
    Pallet          Status          Number          Time
    A          MoveIn          48          11:11
    A          Pick          -1          11:11I assume that you're just not displaying the full time, and your data is really something like:
    Pallet          Status          Number          Time
    A          MoveIn          48          23-Sep-2011 11:11:01
    A          Pick          -1          23-Sep-2011 11:11:08Otherwise, how do you know if these two rows are in te same group or not? You may need to add a tie-breaker to the analytic ORDER BY clause. For example, if you say "ORDER BY time, *status* ", then, if the two rows above really did have exactly the same time, down to the second, then the one with status='MoveIn' would be considered to be earlier than the row with status='Pick'.

  • Can Smart Groups split a large e-mail Group

    We have a Group mailing list for our Newsletter.  To send the Newsletter with Mail, we put my name into the "To" field and put the Group into the bcc field.
    Due to ISP restrictions, when the Group became larger than 99, we split this one Group into 2 smaller "Smart Groups" by selecting names with and then without the letter "s" in their name.  This method split the names fairly evenly.  We would then send the Newsletter to the first Smart Group one day, and to the second Smart Group on the following day.  This system worked well, until now.
    The problem is now the main Group is over 200 and we need to split it into 3 smaller Groups.  Can anyone think of a way to do this using Smart Groups?
    (Just like my HS PhysEd teacher once said:  "I want you guys to pair off in threes.")

    Thanks, we'll try that.
    Actually, since we have Google Apps for Business it appears that we might be allowed to send either 500 or 2000 messages daily but no more than 99 addresses in any one message.  Not sure if their "no more than 100" when using AppleMail applies or not when using Google Apps for Business.
    ConstantContact would work but it costs $15/month.  Hoolie has a one-time $40 charge but you must use your own ISP.

  • BPM group vote result

    Hi All,
    I am using the group vote(GP).
    It is a parallel, and i assign the voting to 2 users(User A and User B).
    The outcome of the GP can be rejected if at least one reject  and accepted elsewere.
    I would like to implement the following behavior:
    In case of a rejection, if reject was done by User A then perfoming HumanTaskA else perfoming HumanTAskB.
    Is there any way for accessing the result of the group vote in an easy way?
    Regards Piero

    If you need to store the separate answers they each give, then you might instead want to consider using a Subprocess (multi-instance) instead of using a "group" human task.
    If you go this route, you would base how the multi-instance subprocess "bursts" your 2 to 7 items inside the subprocess on an array (collection) of business objects. Each item in the subprocess would indicate who the work item should be assigned to using a simple User interactive activity. When the user answers the question inside the interactive activity's human task, their answer would be stored in the array along with their user id.
    Dan

Maybe you are looking for

  • Dirty printing hp

    hi, we using the HP color printer -HP LJ 300-400 M351-M451 6 and it prints pretty messy. It shows blue lines and the edge has black and blue lines. we tried to self clean and the test paper was clean. Do you have any clue? Thank you

  • RBL exceptions

    Hi. We are using Iplanet 5.2 p2 on Solaris 8. We were using some RBL lists and everything was ok and the spam reduces like 90%. Now we have a problem, some servers are reported like spamers but we want to receive emails from them, and we want a speci

  • How to view my saved proxy login & password information?

    So let's say I forgot them and I need to see them, where does Firefox store them? I checked cookies.sqlite file and tried to find by proxy's ip/name keywords but nothing was retrieved as a result. So is there a way I can look up the proxy's login and

  • Song replays from beginning after waking from sleep

    I've tried searching for a solution with no luck. Heres what happens. 1. I'm playing music. 2. Midway into the song, I get a call. 3. I answer phone 4. as soon as I answer, I lock the phone with the sleep button so I safely put it back into my pocket

  • Can I change scope in my jsp file ??

    Hi all, I have html form, jsp for display, bean for Logic and I want the project result is doing sarch in html file, bean handle the search in database, and display in jsp, since the database is big, the result is lot, so I want my search result be d