Select showing Two rows in only one

hi everybody!
I have a table with this registers:
name key value
A month 1
A day 2
B month 1
B day 2
i want to make a select showing
name month day
A 1 2
B 1 2

you might find this example helpful.
SQL> select * from pivot_tab;
      COL1 COL2
         1 a
         1 b
         1 c
         2 h
         2 h
SQL>
SQL>
SQL> select p.col1,
  2         substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
  3         as col2
  4    from (select col1,
  5                 col2,
  6                 row_number() over (partition by col1 order by col1, col2) rn
  7            from pivot_tab) p
  8  start with p.rn = 1
  9  connect by p.rn = prior p.rn + 1
10  and prior p.col1 = p.col1
11  group by col1;
      COL1 COL2
         1 a,b,c
         2 h,h
SQL>

Similar Messages

  • BI Report is showing two rows for a single record

    Dear Experts
    This is Raja
    I am Facing one issue in BI Report,
    I have created report based on a Infocube which is getting data from two DSO. one is Standard [ Billing Condition Data]and another one is ZDSO[Targets}. these two requests go in the Infocube
    1. Budget- zdbudget [DSO]
    2.Actuals -0sd_o06 [DSO]
    I need to make report  Like this :For a specific period
    EX:1
    Material    Sold to party    Actual   Budget/Target     Variance    Actual YTD  Budget YTD
    M100        S100                 21         30                         10               21                  30
    here budget{ Budget DSO} values i am getting Material wise sold to party is not coming through file. But for Actual values sold to party is coming, that's why my report is showing like this..
    Ex:2
    Material    Sold to party    Actual   Budget/Target     Variance    Actual YTD  Budget YTD
    M100        S100                 21                                      10               21                 
                                      30                       -30                                        30
    Since the sold to party is not available in Budget DSO in the report For Every Material it's showing Two Rows.
    How can bring this in to one Line..Like EX:1
    Please give Valuable Suggestions..

    Say the data is like this.
    Material Sold to Party Act Bud
    M1          S1               100   0
    M1          #                    0    50
    M1          S2               200   0
    And you want to see like below.
    Material Sold to Party Act Bud
    M1          S1               100   50
    M1          S2               200   50
    If this is your requirement, let the sold to party be in Rows.
    In columns, for budget, create a local selection, drag budget kf, sold to party (restrict this by # and right click and choose constant selection). This makes the budget kf independent of what is coming in the rows and always shows data corresponding to sold to party #. Hope this is clear.

  • Producedure givng two rows instead of one row

    Hi
    Please find below my procedure..when I execute this proc...displays two rows instead of one row. Please help me incase if I did mistake.
    CREATE PROCEDURE SP_CWCTravel_Cruise_Amenities_S(
            @Cruise_Line_Code varchar(2500) = NULL,
            @Ship_Code varchar(2500) = NULL,
            @Sail_Id varchar(100) = NULL,
            @Base_Price decimal(8, 2),
            @Category_Groups varchar(2500) = NULL,
            @Categories varchar(2500) = NULL,
            @Rate_Codes varchar(2500) = NULL,
            @Booking_Date VARCHAR( 10 ),
            @Sail_Start_Date VARCHAR( 10 )
    AS
    BEGIN
        SELECT  TOP 1 *
        FROM CWCTravel_Cruise_Amenities_Definition as cad
                                    JOIN CWCTravel_Cruise_Amenities_Definition_Date_Range AS caddr
                                    ON cad.id = caddr.Amenities_Definition_Id
        WHERE Cruise_Line_Code in (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Cruise_Line_Code))
            AND (Min_Base_Price = 0 OR Min_Base_Price <= @Base_Price)
            AND (Max_Base_Price = 0 OR Max_Base_Price >= @Base_Price)
            AND (Ship_Code IS NULL OR Ship_Code = '' OR Ship_Code IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Ship_Code)))
            AND (Sail_Id IS NULL OR Sail_Id = '' OR Sail_Id IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Sail_Id))) 
            AND (Rate_Codes IS NULL OR Rate_Codes = '' OR ((SELECT COUNT(*) FROM
                                                                                       (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Rate_Codes)) A,
                                                                                       (SELECT REPLACE(REPLACE(Item,'?', '_'), '*', '%') Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Rate_Codes)) B
                                                                                        WHERE A.Item LIKE B.Item) > 0))
                                    AND (Category_Groups IS NULL OR Category_Groups = '' OR ((SELECT COUNT(*) FROM
                                                                                       (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Category_Groups)) A,
                                                                                       (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Category_Groups)) B
                                                                                        WHERE A.Item LIKE B.Item) > 0))
                    AND (Categories IS NULL OR Categories = '' OR ((SELECT COUNT(*) FROM
                                                                                       (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Categories)) A,
                                                                                       (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Categories)) B
                                                                                        WHERE A.Item LIKE B.Item) > 0))
                                    AND  (@Booking_Date is null or @Booking_Date=''
                                                                                                    OR (( caddr.from_date IS NULL OR caddr.from_date <= @Booking_Date ) AND ( caddr.to_date IS NULL OR caddr.to_date >= @Booking_Date )                                                                                   
                                                                                    AND  (( caddr.date_range_type IS NULL ) OR ( caddr.date_range_type = 'BOOK_DATE' ))) )
        union
        SELECT  TOP 1 *
        FROM CWCTravel_Cruise_Amenities_Definition as cad
                                    JOIN CWCTravel_Cruise_Amenities_Definition_Date_Range AS caddr
                                    ON cad.id = caddr.Amenities_Definition_Id
        WHERE Cruise_Line_Code in (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Cruise_Line_Code))
            AND (Min_Base_Price = 0 OR Min_Base_Price <= @Base_Price)
            AND (Max_Base_Price = 0 OR Max_Base_Price >= @Base_Price)
            AND (Ship_Code IS NULL OR Ship_Code = '' OR Ship_Code IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Ship_Code)))
            AND (Sail_Id IS NULL OR Sail_Id = '' OR Sail_Id IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Sail_Id))) 
            AND (Rate_Codes IS NULL OR Rate_Codes = '' OR ((SELECT COUNT(*) FROM
                                                                                       (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Rate_Codes)) A,
                                                                                       (SELECT REPLACE(REPLACE(Item,'?', '_'), '*', '%') Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Rate_Codes)) B
                                                                                        WHERE A.Item LIKE B.Item) > 0))
                                    AND (Category_Groups IS NULL OR Category_Groups = '' OR ((SELECT COUNT(*) FROM
                                                                                       (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Category_Groups)) A,
                                                                                       (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Category_Groups)) B
                                                                                        WHERE A.Item LIKE B.Item) > 0))
                    AND (Categories IS NULL OR Categories = '' OR ((SELECT COUNT(*) FROM
                                                                                       (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Categories)) A,
                                                                                       (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Categories)) B
                                                                                        WHERE A.Item LIKE B.Item) > 0))
            AND  (@Sail_Start_Date is null or @Sail_Start_Date=''
                                                                                                    OR (( caddr.from_date IS NULL OR caddr.from_date <= @Sail_Start_Date ) AND ( caddr.to_date IS NULL OR caddr.to_date >= @Sail_Start_Date )                                                                                   
                                                                                    AND  (( caddr.date_range_type IS NULL ) OR ( caddr.date_range_type = 'TRAVEL_DATE' ))) )                                                                        
        ORDER BY Cruise_Line_Code DESC, Ship_Code DESC, Sail_Id DESC, Rate_Codes DESC, Category_Groups DESC, Categories DESC
    ENDWhile executing this SP
    I am getting the following results.
    2043 23-07-2010 AM 11:22:10 23-08-2011 PM 04:57:19 8 princess caribbeanPrincess 2043 20-08-2011 AM 12:00:00 30-11-2011 AM 12:00:00 BOOK_DATE
    2043 23-07-2010 AM 11:22:10 23-08-2011 PM 04:57:19 8 princess caribbeanPrincess 2043 01-10-2011 AM 12:00:00 30-11-2011 AM 12:00:00 TRAVEL_DATE
    I need only the first record.
    Thanks in adv
    Rekha

    871270 wrote:
    Hi
    Please find below my procedure..when I execute this proc...displays two rows instead of one row. Please help me incase if I did mistake.Seriously?
    You wrote a query against tables we've never seen, containing data we can't possibly have any idea about and you expect us to be able to help you?
    Please go discuss this with someone in your organization who understands the data model and have them explain to you how it is supposed to work.
    Put yourself in our situation (forum volunteers) ... if we threw some arbitrary code with no explanation as to what it does, what the data model looks like and what's supposed to be happening, do you think you'd be very successful ?

  • Logic to show two rows of a column as Single row

    Hi
    I need output some thing like below
    ind type amount
    xxxx abc 123
    bac 456
    yyyy abc 123
    bac 456
    zzzzz abc 123
    bac 456
    two rows considered as one row .
    Can any one please help me how to solve this.

    sample like
    iin the first two the column ind should be show as single xxxx and also type with in same row
    Edited by: varma on Apr 10, 2012 1:27 PM

  • We have two iphones and only one ipad.  We want to be able to use "find my iphone" for both phones, which have separate apple ids.  How do we get our ipad to accept this?

    We have two iphones and only one ipad - no mac.  We want to be able to use "find my iphone" for both phones.  How do we get the ipad to accept two iphone accounts?  icloud is enabled on all three devices. 

    Also, be aware of the following:
    The "Find my..." function is pretty much useless if the device is in the hands of a thief.  All that is necessary is for the thief to connect to any computer with iTunes and "Restore as new."
    The only real protection you have is with the personal information on the device rather than the physical device itself.  Something as small as an iPod/iPhone should have a strong 8-digit (or longer) password AND be configured for automatic wipe in the event of ten consecutive incorrect password entries.

  • HP Laserjet CP1025nw Color Printer - printer prints two copies when only one is requested.

    pcwizard (HP) requested that I try Foxit Reader 5.1 to see if the printer will print properly.  I used the same previous document and printed it with Foxit Reader 5.1.  The printer printed two copies when only one was requested as it had done in the past.  We still have a problem.
    I am using Windows 7 (64 bit) for OS.  I have experience the issue on two different computers.
    dslledyrt
    This question was solved.
    View Solution.

    Hi dslledyrt,
    Can you install the Basic Driver for the printer on one of the computers, and let me know if you still have this issue?
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=lj-90357-1&cc=us&dlc=en&lc=en&...=
    I am an HP employee.
    Say Thanks by clicking the Kudos Star in the post that helped you.
    Please mark the post that solves your problem as "Accepted Solution"

  • Showing report data columns into two rows instead of one row using SSRS 2012

    Hi All,
    I have a ssrs report with 13 columns and I want to show those 13 columns data into two rows instead of showing in one row. please send me step by step process.
    id     fullname     firstname      lastname        mailingaddress     billingaddress       
    city       state       zipcode   
    1       ABC                A                  C                  
        xyz                      xyz123                   york     
    PA          12345    
     homephone     cellphone          workphone          company    
    1234567890      4567890123     0123456789         ABC,Inc
    id     fullname     firstname      lastname        mailingaddress     billingaddress        
    city          state     zipcode   
    2          XYZ               X                  Z                      
         abc                     abc123           lewisburg     
    PA      54321    
     homephone     cellphone           workphone        company    
    4567890123      0123456789     1234567890         xyz,Inc
    id     fullname     firstname      lastname        mailingaddress     billingaddress        
    city          state     zipcode   
    3       BCD                  B                  D                  
    123abc                  xyz123                leesburg       PA     
     54123    
     homephone     cellphone          workphone        company    
    4567895623      0783456789     1238967890       Hey,Inc
    Thanks in advance,
    RH
    sql

    Do a right mouse click on the left, gray row marker => "Insert Row"=> "Inside Group
    - Above or Below", then you get a second detail row.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • I have two email accounts only one is showing contacts calendars and reminders, how can I have both sets of contacts show up

    I have 2 email accounts but only one of them is showing its contacts how can I get both accounts to show contacts?

    Hi Rochdr,
    You can use the following article to help you address this issue with your mail account in OS X:
    OS X Mail: Troubleshooting sending and receiving email messages
    http://support.apple.com/kb/ts3276
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • Dimension variable shows two rows in Webi report

    Hello everyone!
    I want to build a report with the following structure:
    Account group 1 | KYF 1| KYF 2
    For this effect, I've created a dimension variable called "Account group 1" with a formula like "GL account starts with "64"".
    With this I'm getting two rows: one with the correct value and another with the aggregated value of the remaining accounts.
    How can I make this return only one row with the restricted values I want?
    Best Regards,
    Luís Andrade.

    Hi Luis,
    There are two ways to do it.
    1. Simplest solution use a report filter by selecting the Account Group column and selecting the accounts.
    2. If the above one doesn't work if the report refreshes and new accounts come in, the other way is create one more variable named group2 or something, as dimension and use an if statement where if account group = account starting with GL Then group1 Else NULL. now apply the report filter where group2 not equal to "NULL". Now you will not have the last row as before.
    I think one of this should be helpful.
    Thanks,
    Rajesh

  • Multiple devices showing in iTunes when only one device is plugged in

    How come multiple devices show up in iTunes left-hand DEVICES column when I plug in only one device? When I plug in my iPhone, two of the same devices by the same name show up in the left hand column within iTunes, ALONG with two other iPhones in our family. Can anyone offer insight please? Thank you in advance!

    You may have enabled wifi sync on your iPhone.

  • ICal sync between two people if only one person has a .Mac account

    Is there a way for two people to sync/edit iCal calendars if only one person has a .Mac account? I'd only want to selectively share/sync part of my iCal calendar and not the entire iCal calendar.
    Any ideas?

    I think you meant to say "merge"
    I am trying at the moment with fingers crossed.
    One has Leopard the other Tiger. I hope it works.
    Oh I turned on airplane mode and disconnected from the internet just to be sure sync doesn't get stuck.
    Asked me to resolve 6 conflicts.. that's a good sign. It is taking a long time though. I hope it won't take so long every time I go from one computer to another. Otherwise it is easier to pass the files via iChat.
    The file for address book is addressbook data in library/applicationsupport/address book
    for iCal I make an export VCal file and then on the other computer delete the calendar and import the new one.
    On the computer with Music I set it to manage manually.
    OK I think I will have to do it like that because this took forever then it said it would have to modify 836 entries on my calendar for what was almost the same file.
    The photo sync is annoying but I just turn off iPhoto when it asks to find my library (or you can make another program be the default program when you attach a camera and that program will come on then you can just quit it). I find the auto photo sync annoying as it takes so long and I would rather do that manually.

  • SELECT to find records with only one word

    What function should I use to find all rows where a particular column has only one word in it? It's a 'Contact Person' column, but the data there is not neccessarily First Name space Last Name...

    If your definition of "One Word" means that the column doesn't contain a space,
    you could do something like this:
    select * from YourTable
    where Instr(Trim(ContactPerson), ' ') = 0;Message was edited by:
    dccase

  • Why 1: Type selected in yellow and 2: only one panel stays open?

    In Design CS4. G5 Mac. Final Tiger.
    1. I was setting some type to be force justified L/R. Several lines of centered type. Most of it, not all of it, became selected in solid yellow. I did not do the selecting. I could not find the answer in either of two ID reference books.
    I checked the Prefs several times, and the only thing I found that MIGHT relate to this is "Keeps." (Preferences > Composition > Keeps Violations/H&J Violations.) Though it says nothing about color choice nor about what it signifies. I know what pink signifies, but not what yellow does.
    2. Asked about this next problem before and was told about Workspaces and was told about grouping panels, neither answering the question as I recall. So let me try again.
    I have panel A open. It may be alone as Panel A or in a group with Panel B and maybe even with Panel C. Doesn't matter. But now I want to open Panel D. As soon as I click on Panel D, Panel A (alone or grouped) disappears. So my question is: Can I/how can I keep more than one panel open at the same time, grouped or single being 100% irrelevant? How can I keep Panel A and Panel D open at the same time as separate, not grouped, panels?
    I tried to ask clearly. My experience is it is most efficient (in Adobe Forums and in real life) to be clear about what you do want and equally clear about what you do not.  —Thank you.

    1. Yellow highlight is, I believe, substituted glyphs. Is the affected type all caps or samll caps, perchance, or non-default figures? You usually see this with ligatures, but small caps is pretty common, too.
    2. Do you have auto-collapse panels selected inthe prefs? This one would help to see a screen shot, I think. If the panels are docked, you must expand the dock to panel width or only one group (and a group can be one panel) will expand from the icon state at a time.

  • Missing rows / output only one row in a Report after applying patchset 2

    Hi.
    We use Reports Builder for 10g R2. We had the problem with our AS 10g R2 on windows 2003, that some reports creates duplicate rows when it is a ASCII report (desformat = delimited), see Bug 3340546.
    Now we apply Patchset 2 on a local machine, to test the functionality. It fix the problem (look in metalink doc ID 398955.1 under "2.12 Oracle Reports Developer Bugs")-
    But now most csv reports creates only one row instead of multiple rows.
    We run reports on our local machine with OC4N and local started Form (via Forms Builder) to generate the reports (local started report server) from DevSuite).
    When we start the reports with desformat=delimited the txt-file has only the header row and one data row (instead of multiple ones).
    And when we generate the same report with desformat=delimiteddata it looks fine and generates all rows as expected.
    We found neither here in the forum or in metalink knowledge base nor on the internet.
    Have you any suggestions for us how to fix this problem?
    Using delimiteddata is now acceptable solution for us, because delimited is easier to use.
    Thanks for your help!

    Hey folks.
    We have solved the problem. :)
    We applied PatchSet2 for 10gR2. But we don´t know how the csv-report outputs only 1 data-row instead of several rows.
    Than we create a similar report (with the same sql-query) as a new one with the reports builder assistant.
    This one works pretty fine. So we looked for the attributes and see the "max. number datasets for each site" and it was in the new one set to 0 and in our old one set to 1.
    So we change this and ... the old one works pretty fine! :)
    So the problem is, that this attribute does not had any consequences in the old version. But since we update with PatchSet 2 it respect this attribute but we don´t "see" it.
    Hope this helps others.

  • Selecting consecutive two rows

    hi all,
    i have a table 'sample' with following values
    SAMPLE
    COL1
    1
    1
    2
    2
    2
    3
    3
    4
    4
    6
    6
    6
    In this column i need to display top two rows with their values...
    wat i need exactly is shown below!!!!
    Sample Output of my Query; When i run the query first time the query should give the following result
    1
    1
    2
    2
    2
    Similarly when i run the query for second time the Query result should as follows;
    3
    3
    4
    4
    Likewise
    Pls help me out.
    Thanx In Advance,
    SIMBHU..

    You can use dense_rank setting up a consecutive rank over the values in your table. Restrict the queries to the derived rank. Of course, you´ll have to store the values of the ranks you fetched at least and set the where-clause for each fetch. Thats where Tom´s example comes into play.
    The query could look like this:
    SQL> select *
      2  from test_
      3  ;
          COL1
             1
             1
             1
             2
             2
             3
             4
             4
             4
             5
             5
          COL1
             5
             5
             6
             6
             7
    16 rows selected.
    SQL> select col1
      2  from
      3         (
      4         select col1, dense_rank() over (order by col1 asc) n
      5         from test_
      6         order by col1
      7         )
      8  where  n between 1 and 2
      9  ;
          COL1
             1
             1
             1
             2
             2
    SQL> select col1
      2  from
      3         (
      4         select col1, dense_rank() over (order by col1 asc) n
      5         from test_
      6         order by col1
      7         )
      8  where n between 3 and 4
      9  ;
          COL1
             3
             4
             4
             4
    SQL> Regards,
    Gerd

Maybe you are looking for

  • Error while creating Consignment PO

    Dear Gurus, I am getting error message as 'Account assignment is mandatory for a material' while creating consignment PO with item category 'K'.Could you please address the problem? Note:I have created Material master record and Consignment info reco

  • Generating a report w/ block diagram & programatically specified case structure?

    Hi, I am trying to generate a report that shows the block diagram for a programatically specific case structure. The case structure has ~90 cases and is selected by a custom control. I'm on Labview 8.5 I've found with the Append Block Diagram to VI,

  • Uc560 fxo port not answering incoming calls

    Hi, My customer is facing problem for incoming calls in uc560 fxo port.They have 12 PSTN lines which is connected to UC system.System is configured with Auto-Attendant also. almost all days they are facing this major issue of incoming call is not get

  • Finished material forecast

    Hi Gurus, Can anybody please clarify my confusion. Our business wants to forecast to the finished material, saying how many will need to be produced in a given time frame. based on this the system will kick the reuqirements down to the level of raw m

  • Quick view in sqvi

    Dear gurus, i have created one quick view for scheduling agreement  where in all pending delivery schedules for a perticuler period will appear .  but i am not getting the table for OBMNG ( open quantity ). if this is the result of deduction from sch