Grouping data issue

Hi friends,
I am struck on a issue for which i am trying to find a solution. The issue is i have a select statement which returns me the data like below. The first column is the date column, the second and third column represent the count based on the column 4 and column 5. i.e, column 2 is mapped based on col4 and col3 is mapped to col5. I want the data in the table to be grouped based on the col4 and col5.
Existing table
Date col2 col3 col4 col5
2010-07-25     3     7     26     26
2010-07-25     3     3     26     505
2010-07-25     1     7     505     26
2010-07-25     1     3     505     505
Desired table
Date col2 col3 col4 col5
2010-07-25     3     7     26     26
2010-07-25     1     3     505     505
Could you please let me know how to do it.
Note: Topic is moved to SQL/PLSQL forum
Edited by: bluerose on Aug 20, 2011 1:53 AM

for the data provided it seems just
... where col4 = col 5or reading the requirement maybe (NOT TESTED!)
select x.date,x.col2,y.col3,x.col4,y.col5
  from (select max(date) date,max(col2) col2,col4
         group by col4
       ) x,
       (select max(date) date,max(col3) col3,col5
         group by col5
       ) y
where x.col4 = y.col5Regards
Etbin

Similar Messages

  • Master data Issue  ---   materials have unassigned or # values ...!!

    Hello Experts,
    I am facing an issue that the Customer Data is missing in a BEx Report.
    Data Flow is   2LIS_13_VDITM  --> DSO1 --> Merging DSO -->  Cube --> Multiprovider --> Bex Report.
    Exact issue is Customers in the Bex Report  has unassigned to Sales Office, Sales Group, Sales District.
    The only reason a customer should show up under u201Cunassignedu201D or u201C#u201D is if itu2019s improperly set up in the system.
    customers are assigned with two values. one which has data and the other which has unassigned value.
    I wanted to know, how do i check if the matierials are valid to have unassigned Values ?
    Checked the Merging DSO and saw that there are actually values assigned values for the affected matierials.
    After that checked the Cube data values are displayed except the Master Data values.
    I guess..its completely related to Master data. I would like to know how can i resolve this issue.
    Please reply me if you face this kind of master data issue in your expeiriance.
    Thanks,
    SN.

    Hi,
    Are Sales Office, Sales Group, Sales District are attributes of Customer?
    In case they are, then the customers will be unassigned to Sales Office, Sales Group, Sales District in case the data for these attributes is loaded to the customer attributes.
    and also check if the customer characteristic is properly assigned in the multiprovider.
    Check if it helps.
    Regards,
    Joe

  • How to group data from two tables ?

    Hello,
    I have two tables and i want to group data from them but two table not linked.
    Table TEXT_IN : ID_IN (primary_key), DATE_IN
    Table TEXT_OUT : ID_OUT(primary_key),DATE_OUT
    Example :
    Result :Group Date and Order by IN,OUT
    And It seems a bit
    confusing because we do not link
    .You can give me solutions.
    Thank you.

    SELECT MAX(CASE WHEN Rn = 1 THEN [IN] END) AS [IN1],
    MAX(CASE WHEN Rn = 1 THEN [OUT] END) AS [OUT1],
    MAX(CASE WHEN Rn = 2 THEN [IN] END) AS [IN2],
    MAX(CASE WHEN Rn = 2 THEN [OUT] END) AS [OUT2],
    MAX(CASE WHEN Rn = 3 THEN [IN] END) AS [IN3],
    MAX(CASE WHEN Rn = 3 THEN [OUT] END) AS [OUT3],
    MAX(CASE WHEN Rn = 4 THEN [IN] END) AS [IN4],
    MAX(CASE WHEN Rn = 4 THEN [OUT] END) AS [OUT4],
    MAX(CASE WHEN Rn = 5 THEN [IN] END) AS [IN5],
    MAX(CASE WHEN Rn = 5 THEN [OUT] END) AS [OUT5],
    FROM
    SELECT COALESCE(m.DATE_IN,n.DATE_IN) AS DATE_IN,
    COALESCE(m.Seq,n.Seq) AS Seq,
    ID_IN AS [IN],
    ID_OUT AS [OUT],
    ROW_NUMBER() OVER (PARTITION BY Seq ORDER BY COALESCE(m.DATE_IN,n.DATE_IN)) AS Rn
    FROM
    SELECT ROW_NUMBER() OVER (PARTITION BY DATE_IN ORDER BY DATE_IN) AS Seq,*
    FROM TEXT_IN
    )m
    FULL OUTER JOIN
    SELECT ROW_NUMBER() OVER (PARTITION BY DATE_IN ORDER BY DATE_IN) AS Seq,*
    FROM TEXT_OUT
    )n
    ON n.Seq = m.Seq
    AND n.DATE_IN = m.DATE_IN
    )t
    GROUP BY Seq
    to make it dynamic see
    http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to control outer group data based on inner group data

    Hi ,
    Please can anyyone help me on this issue.
    I have one invoice header record and for that invoice there are 15invoice lines record.
    1)my requirement is i want to print the 10 invoice records in first page and remaining records,in next page.--this i had achieved*(byusing solution posted inthe forum)*
    i have the layout like this
    image:!C:\Documents and Settings\madhu.rn\Desktop\layout.jpg!
    main group data table
    i had inserted another table for inner group data.
    again main group data in main table.
    2)But here i don't want print header info again in second page.
    3)i am not getting the line numbers in inner group in ascending order ,i am getting in descending order. how to get them in decending order
    4) if lines record are going to second page i don't want to print subtotal,tax,total (these are main group data)in first page, instead of this
    in place of
    subtotal-- want to print Continued......
    Tax- null
    Total:page 1 of 2. like that i want to print in first page.
    i want them to print in second page.
    5)the bottom portion also not to print on second page.(after innergroup data,there is some main group data)
    i have one doubt by using inner group data whether we can control outer group data.
    if any of my requirement's are not possible to meet ,please provide me the information.
    This urgent for me,have to submit it.
    Edited by: user644268 on Feb 8, 2010 11:10 AM

    Hi,
    Please help me in this issue. Its an urgent requirement.
    Thanks in Advance..

  • Data Issue

    Hi All ..
               We are facing one data issue DSO.  One record is worngly loaded with some project iD ( Ex record is having ID GE1234 insted of having LE4423) remaining details are same . we are loading the data furtherly to master data table from the DSO. if i try  for reporting for project id LE4423 ,information not avilable because it is heaving wrong ID,it is key also.But in the Source system (CFG) side Data is correct with ID LE4423.
             In update rule we are following one to one mapping for all infoobjects.My requirement is i need to have in my DSo LE4423 . I need to overwrite the record id GE1234 with LE4423 without affecting other fields in the record.
            Shall i load till PSA with the ID LE4423 ..then if load this single record to DSO will overwrite the GE1234 by choosing other field as key field.  but we are following one to one mapping in update rule.
    Please help me on this. i need to hev a correct id for record.
    Thanks ,
    Prem.

    You can use selective deletion to delete the record with Project ID = GE1234
    Load the data till PSA
    Load the data to DSO using selection Project ID = LE4423 in DTP from PSA.
    check in further data targets also for mismatch of data
    Hope it helps,
    Naveen Vytla
    Edited by: Naveen Vytla on Nov 18, 2008 10:49 AM

  • Custom report -Mb51 -EBELN,AUFNR,KDAUF & KUNNR -Data issues

    Hi,
    This custom report is related to material document list (MB51).
    I was trying to retrieve Purchase Order(EBELN),Order number(AUFNR),Sales order(KDAUF) & Ship-to-party( KUNNR) from MSEG & MKPF.
    Unfortunately
    It looks like for Sales Orders, it picks up the Customer Number but no Order Number. For STO’s, it looks like it picks up the STO # but no Customer #.
    How to over come this?
    FYI..I also tried adding fields to standard report(MB51) and it is also doing the same manner .
    Am I pulling it from Wrong tables? or is it related to DATA issues?
    Regards
    Praveen
    Message was edited by:
            PRAVEEN s

    Hi,
    This custom report is related to material document list (MB51).
    I was trying to retrieve Purchase Order(EBELN),Order number(AUFNR),Sales order(KDAUF) & Ship-to-party( KUNNR) from MSEG & MKPF.
    Unfortunately
    It looks like for Sales Orders, it picks up the Customer Number but no Order Number. For STO’s, it looks like it picks up the STO # but no Customer #.
    How to over come this?
    FYI..I also tried adding fields to standard report(MB51) and it is also doing the same manner .
    Am I pulling it from Wrong tables? or is it related to DATA issues?
    Regards
    Praveen
    Message was edited by:
            PRAVEEN s

  • Consistent Data Issues Even After Replacement

    I don't know whether to blame the phone or the ice cream sandwich update for all the problems I have been having with my RAZR. When I first got it six months ago it was great and I loved it now after the ice cream sandwich update I dont really like it anymore. I never had any sort of issues while using it on gingerbread. Today, I have seen my phone switch constantly between 3g and 4g more times than I can count over the course of half an hour. I couldn't even get a consistent signal to watch a 3 minute youtube clip.
    First off, I updated it to ICS but first wiped the phone clean including cache, etc. So it would have basically been a clean install. Now, I have certain issues. The 4g and 3g switch is terrible. On the street and in my own house I have had the same thing happen. In my house I get anywhere from 3-5 bars of 4g but it still switches over to 4 bars of 3g. I have even seen it switch from 4g to 3g when I had full bars. I have already replaced the sim cards, but I am still having these issues. It's actually happening on all 4 of my RAZRs on my family plan. I have gone through the network resets where I pull out the sim card and for 30 seconds, insert it, power on the phone, etc. I went through all 4 of them with the Rep over the phone. I have also had several instances where I did not have data but signal bars and then I didn't have absolutely anything at all. I live in a "major" city metro area, Boston, and I can't believe I am having these problems.
    At first I would have gone off and blamed Verizon, but it is definitely not Verizon, it is our phones that are terrible. I can confirm this because my brother uses an ipad (4g Verizon) on a separate account and he consistently maintains 4g even though I have seen it go as low as two bars. Yes, I understand the ipad is a different device and may have a different radio, but that is exactly how our phones used to work on gingerbread. I received a replacement device and I am still having the same issues. Also, the headset speaker, not the speaker on the back, or receiver is really tinny during phone calls even with the in call volume down half way. It is really annoying and the little tone that plays after hanging up makes the speaker sound like its about to blow out. I don't know what to do if the RAZR will keep having data issues because this is absolutely ridiculous. I know i'm not entitled to anything but for $310 a month I mean come on, I just want my phone to work properly. As I am typing this now, I have witnessed my phone switch between 4g, 3g, and no signal at least 5 times and of course my brother's iPad on Verizon has kept its 4g signal.

    Thanks for all the suggestions, but they just don't work at all guys. I've even tried that restore connectivity app from Motorola, but of course it didn't work. I don't like that I keep having constant switches between 3g,4g, and no signal bars. It's awful thats just what it is. I feel like I got gipped with this update promising better user experience. If the darned thing can't connect to their network, then what is Verizon doing to address these issues? Every time I try to do something "data intensive" (i.e. youtube, facebook, twitter, etc) the data signal just drops and I'm either left with gray bars and no data or no signal bars whatsoever. Also one thing that annoys me to death with this phone is that I have it sitting in my pocket after I lock the screen and I go to pull it out of my otherwise empty pocket. The screen is turned on by itself (I have the clear silicon case on it so the power button shouldn't be pressed by itself and no I don't wear skinny jeans), its got 3g and no bars, and its piping hot.
    WHAT IS WRONG WITH THIS PHONE VERIZON???!!!

  • OBIEE 11g .0d date issue

    Hi,
    I create an initialization block to populate a couple of repository variables.
    After saving the RDP the value for the default initializer changes from 2011 to 2011.0d
    I have been using several workaround. But I need some permanent fix in rpd itself. Can anyone point to some Oracle Document? Is this issue been resolved in latest release of OBIEE. I am using 11.1.1.6.6.
    Workaround Ref : The .0d date issue
    Re: OBIEE 11.1.1.6.2 BP1 Repository Variable data type

    Have you gone through my suggestions at the below links?
    The .0d date issue
    Re: OBIEE 11.1.1.6.2 BP1 Repository Variable data type
    You have to do it where ever you are using that rep. variable not in the init block.

  • Verizon mades changes in the coding and now Windows Phone 7 is having data issues!!!

    Starting about 3 weeks ago, I stopped receiving text messages and even worse stopped receiving calls yet alone my voicemails.  I have changed not one thing to my phone, everything is exactly the way it was before the issues arised.  Now I have to trick my phone to receive my data by dialing into my voicemail...  And then what do you know, 30 text mesages, 12 voicemails!!!
    The voicemails wont even tell you the date or time stamp (the time the voicemail was received).  After numerous *228 and talking with level 2 over the holidays, I see a huge article on multiple news sites stating Verizon is having data issues...  Dropped calls, loss of data, no signal while all our phone keep showing full bars and 3g.  Verizon stated its only happening on there 4gLTE system and not 3G but thats a load of crap.
    All one has to do is a google search of loss of text messages or voicemails on Verizon and you will see 100's up to 1000's of users like you and me all experiencing the same issues.  And not just with Windows Phone 7, but with there baby Driod and iPhone as well.
    What really ****** me off is that Verizon loves to play the blame game or pass the buck game.  Hard Reset your phone and that will solve the problem...  Yeah Right.  If this was our OS and we updated a driver that changed the OS in the background I can see that being the solution.  But for the 100's or 1000's of users that go to work daily, check there emails and text daily, and haven't changed one thing on the phone... THIS IS UNACCEPTABLE!!!
    Now I read an articile for someone extermely close to Microsoft stating that Verizon turned down Nokia's new 4GLTE phone because they have no faith in the operating system and I have to think that maybe behind the scenes Verizon is trying to force us off Windows Phone 7 platform with data issue behind the scene and try to get us all into the Droid Platform which they make 50% of the cash off the phone just like the iPhone...
    This is a joke, and I am really starting to think about going to ATT and getting the HTC Titan or the new Nokia 900.  I have already research a 3 party app that will allow you to backup and restore your phone.  And just read that Microsoft just put out an ad for backup, restore and cloud backup programmers for this latest feature.
    Verizon the games need to stop, Verizon you need to stand behind this Platform, Verizon you need to provide better service for all us 3G users!!!
    TheJester77

    Starting about 3 weeks ago, I stopped receiving text messages and even worse stopped receiving calls yet alone my voicemails.  I have changed not one thing to my phone, everything is exactly the way it was before the issues arised.  Now I have to trick my phone to receive my data by dialing into my voicemail...  And then what do you know, 30 text mesages, 12 voicemails!!!
    The voicemails wont even tell you the date or time stamp (the time the voicemail was received).  After numerous *228 and talking with level 2 over the holidays, I see a huge article on multiple news sites stating Verizon is having data issues...  Dropped calls, loss of data, no signal while all our phone keep showing full bars and 3g.  Verizon stated its only happening on there 4gLTE system and not 3G but thats a load of crap.
    All one has to do is a google search of loss of text messages or voicemails on Verizon and you will see 100's up to 1000's of users like you and me all experiencing the same issues.  And not just with Windows Phone 7, but with there baby Driod and iPhone as well.
    What really ****** me off is that Verizon loves to play the blame game or pass the buck game.  Hard Reset your phone and that will solve the problem...  Yeah Right.  If this was our OS and we updated a driver that changed the OS in the background I can see that being the solution.  But for the 100's or 1000's of users that go to work daily, check there emails and text daily, and haven't changed one thing on the phone... THIS IS UNACCEPTABLE!!!
    Now I read an articile for someone extermely close to Microsoft stating that Verizon turned down Nokia's new 4GLTE phone because they have no faith in the operating system and I have to think that maybe behind the scenes Verizon is trying to force us off Windows Phone 7 platform with data issue behind the scene and try to get us all into the Droid Platform which they make 50% of the cash off the phone just like the iPhone...
    This is a joke, and I am really starting to think about going to ATT and getting the HTC Titan or the new Nokia 900.  I have already research a 3 party app that will allow you to backup and restore your phone.  And just read that Microsoft just put out an ad for backup, restore and cloud backup programmers for this latest feature.
    Verizon the games need to stop, Verizon you need to stand behind this Platform, Verizon you need to provide better service for all us 3G users!!!
    TheJester77

  • [Forum FAQ] How do I export each group data to separated Excel files in Reporting Services?

    Introduction
    There is a scenario that a report grouped by one field for some reasons, then the users want to export each group data to separated Excel files. By default, we can directly export only one file at a time on report server. Is there a way that we can split
    the report based on the group, then export each report to Excel file?
    Solution
    To achieve this requirement, we can add a parameter with the group values to filter the report based on the group, then create a data-driven subscription for the report which get File name and parameter from the group values.
    In the report, create a parameter named Name which use the Name field as Available Values (supposing the group grouped on Name field).
    Add a filter as below in the corresponding tablix:
    Expression: [Name]
    Operator: =
    Value: [@Name]
    Deploy the report. Then create a data-driven subscription with Windows File Share delivery extension for the report in Report Manager.
    During the data-driven subscription, in the step 3, specify a query that returns the Name field with the values as the group in the report.
    In the step 4 (Specify delivery extension settings for Report Server FileShare), below “File name”option, select “Get the value from the database”, then select Name field.
    Below ‘Render Format’ option, select Excel as the static value.
    In the step 5, we can configure parameter Name “Get the value from the database”, then select Name field. 
    Then specify the subscription execute only one time.
    References:
    Create a Data-Driven Subscription
    Windows File Share Delivery in Reporting Services
    Applies to
    Reporting Services 2005
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • Data issue in IDOC

    Hi Experts,
    I do the following steps to generate IDOC for Passing over payroll data to ADP.
    I run the payroll and Run the coombined Payroll export and go to WE05 to chk for idoc.
    I have some data issue here. I need the IDOC to Pick 0167 infotype information. For few employees if does generate but for few it does not generate the info in IDOC. Please help me as to how to navigate this problem as iam very new to payroll and as weel as IDOc's.
    Thanks
    Chowdary

    Hello,
    Please try your luck with this.
    Go to BD87 see the error message why this idoc is not moved. some time retrying will you success.
    else also you find the problem in the error message.
    thanks

  • Start to finish, grouped data to xmlp

    Can anyone outline for me the best process by which I would query multi-level grouped data, generating subtotals in the database, and then pass that data to the XML publisher report, with the notion of grouping and subtotals communicated to the report? I don't want to perform the grouping in the report, as it involves large numbers of records. I can find in various places how to generate XML from the database using SQLX, but I don't understand how to get that XML to be used in a report as a datasource. I can paste it in as a query in the MS Word Template builder, but don't know how to get it into the XMLP Enterprise side of things.
    So, given this example query, could someone tell me how to get the data and the meaning of the data into XMLP?
    select emp.deptno,emp.mgr,emp.empno, sum(emp.sal)
    from emp inner join dept
    on (emp.deptno=dept.deptno)
    group by
    rollup(emp.deptno,emp.mgr,emp.empno)

    Oh, yes, I've tried...but I'm at a loss as to how to put the various pieces of XML Publisher together with a data template in the mix. Can anyone give an example of how one would actually go from my example query through data template and .rtf template to final report in XML Publisher Enterprise?

  • Date Issue

    Hello,
    I am a little stuck on a date issue. I need to calculate something like this for a selection criteria formula:
    I need to return this:
    Today is CurrentDate (11/8/2011) - therefore I want to return or calculate next Sunday 11/13/2011 then add 6 days to
    11/13/2011 - 11/19/2011
    So, in English I'd need
    > 11/8/2011 (CurrentDate), find Next Sunday's date (11/13/2011) add 6 days to next Sunday's date (11/13/2011) to get 11/19/2011

    dayofweek(currentdate)
    will give the the day number of the date (1 is Sunday)
    You can use this to generate the dates you need.
    For instance,
    if dayofweek(currentdate)=2 then currentdate + 6
    will give you the next Sunday's date
    Debi
    Edited by: Debi Herbert on Nov 8, 2011 11:44 AM:
    Sorry Ian, I guess was working on this the same time you were. I was just a little slower than you (I had to look it up in my master report of formulas)

  • Date issue in processing billing documents that shipped in a prior period

    Date issue in processing billing documents that shipped in a prior period that is now closed:
    SAP values those deliveries with the current document date in A/R when it should be the original delivery date.  Baseline date needs to stay the delivery date, but is getting copied from the billing date in the new period.  A user exit exists (& needs to be applied) to manipulate the baseline date when the accounting document is being created.
    Any input is appreciated.

    Hi
    Try with Invoice Correction Request concept
    Sale document Type: RK
    Reference Document Type : Billing Number
    for Understanding the Invoice Correction request check below link
    [Creating Invoice Correction Requests|http://help.sap.com/saphelp_46c/helpdata/en/dd/55feeb545a11d1a7020000e829fd11/content.htm]
    Regards,
    Prasanna

  • Overlap date Issue 0hrposition_attr

    Hi
    I'm facing one records overlap date Issue with 0hrposition_attr.Out of 4  records one records i'm getting as start date as future date and end date as past date.I checked in the source i did not see such records.Due to this issue the records are not updated in the target.But i did not notice such issue with 0hrposition_Text  and 0HRPOSITION_CCTR_ATTR load went fine with out any over lap.
    Eg:
    POSITION          VALID FROM          VALID TO
    12345678            04/01/2014            04/20/2014
    12345678            04/21/2014            04/24/2014
    12345678            04/25/2014            04/24/2014
    12345678            04/25/2014            12/31/9999
    I debug  but i did not see any issue,So there any way that  i can delete that particular  records at PSA level so that loads went successful.I attacdshed the document for better idea.
    Regards
    Raj

    Hi,
    only these record is getting the problem and all records.
    check the one record at RSA3 for testing purpose same record check in BW side.
    if you getting like this not problem you can check the only latest record
    12345678       
    04/25/2014       
    12/31/9999
    put the filter at VALID TO data 12/31/9999 and form date 04/25/2014.
    you want lookup the code just add the one more point.
    WHERE POSITION = RESULT_PACKAGE- 0POSITION
         and DATETO = '99991231'.
    it will pick the only latest record.
    Thanks,
    Phani.

Maybe you are looking for

  • Presets in Lightroom mobile

    I have a lot of custom presets that I love to use. Is there a way to import these presets into Lightroom mobile?

  • Large library - can't synch. What gives?

    My iTunes music library is way too large for my iPod classic, and I haven't synched for quite a while. I just updated to the most recent Itunes. There used to be a "do you want iTunes to select the songs for your iPod" option, after it told me my lib

  • How do I get my apps back on the iPad after OS upgrade?

    I upgraded to OS 5 and all my apps are now gone from my iPad.  I can see them all in iTunes and all the data/photos are on the iPad, but none of the apps.  How do I restore or transfer the apps back to my iPad?  Help!

  • Youtube videos are not playing back

    Youtube videos are not playing back in Safari 5.1.7. I've also checked this in Firefox 16.0.2. I am running OS 10.6.8. Why is this happening? I need this capabilitiy for my work efforts. Thanks (in advance)!

  • Array as parameter in a stored procedure called in java

    Hello, In order to transmit an array from java to a PL/SQL procedure with oracle8i, we have been trying to instanciate an javaArrayDescriptor using the name of an oracle user Datatype (a table of Varchar(20)). This works perfectly well while connecte