How to retrieve unique records with more than one column

I have a table sps_prod as described below -
POGNAME VARCHAR2(1500)
INDEX#VERSION VARCHAR2(200)
POG_MODEL_STATUS VARCHAR2(100)
POG_LAYOUT_TYPE VARCHAR2(500)
POG_MARKET_SPECIFIC VARCHAR2(500)
POG_CONTACT_NUMBER VARCHAR2(100)
AREA_SUPPORTED VARCHAR2(500)
POG_COMMENTS VARCHAR2(1500)
POG_FOOTER_COMMENTS VARCHAR2(1500)
POG_ELECTRICAL_LIST_1 VARCHAR2(1500)
POG_ELECTRICAL_LIST_2 VARCHAR2(1500)
POG_CARPENTRY_1 VARCHAR2(1500)
POG_CARPENTRY_2 VARCHAR2(1500)
INSTALLATION_INSTRUCTION_1 VARCHAR2(1500)
INSTALLATION_INSTRUCTION_2 VARCHAR2(1500)
FIXTURE_REORDER_NUMBER VARCHAR2(200)
FIXTURE_ID VARCHAR2(200)
FIXTURE_NAME VARCHAR2(500)
FIXTURE_IMAGE VARCHAR2(500)
PART_REORDER_NUMBER_9 VARCHAR2(500)
PART_FIXTURE_ID_9 VARCHAR2(500)
PART_FIXTURE_NAME_9 VARCHAR2(500)
PART_FIXTURE_IMAGE_9 VARCHAR2(500)
UPC VARCHAR2(50)
ITEM_NUMBER VARCHAR2(50)
DESCRIPTION VARCHAR2(700)
MERCH_TYPE VARCHAR2(20)
HEIGHT VARCHAR2(100)
WIDTH VARCHAR2(100)
DEPTH VARCHAR2(100)
CREATE_TS DATE
There are 4 millions records in it and many with the same combination of POGName,Index#Version,POG_Model_Status,POG_Layout_Type,POG_Market_Specific, POG_Contact_Number and Fixture_Name. How do I retrive records with all the columns above but with unique fixture_name and reorder_number combination. There are no keys defined on the table.
I guess this is a simple problem but the fact that I am trying to retrieve all the columns is stumbling me.
Thanks in advance.

Hi,
Sanders_2503 wrote:
... There are 4 millions records in it and many with the same combination of POGName,Index#Version,POG_Model_Status,POG_Layout_Type,POG_Market_Specific, POG_Contact_Number and Fixture_Name. How do I retrive records with all the columns above but with unique fixture_name and reorder_number combination. I don't see a column called reorder_number. Do you mean fixture_reorder_number or part_reorder_number_9?
So you want only one row for each distinct combination of fixture_name and some other column (I'll assume that's fixture_reorder_number). Does it matter which row? They won't necessarily have the same values for the other columns.
The query below returns the one with the first pogname (in sort order):
WITH     got_r_num     AS
     SELECT  pogname, index#version, pog_model_status, pog_layout_type
     ,     pog_market_specific, pog_contact_number, fixture_name
     ,     ROW_NUMBER () OVER ( PARTITION BY  fixture_name
                               ,                    fixture_reorder_number
                         ORDER BY        pogname
                       )         AS r_num
     FROM    sps_prod
SELECT  pogname, index#version, pog_model_status, pog_layout_type
,     pog_market_specific, pog_contact_number, fixture_name
FROM     got_r_num
WHERE     r_num     = 1
;If there happens to be a tie (that is, two or more rows with the same fixture_name, fixture_number, and first pogname) then one of the will be chosen arbitrarily.
Instead of "ORDER BY pogname", you can ORDER BY any other columns or expressions, but you must have an analytic ORDER BY clause. You can make it "ORDER BY NULL" if you really want to pcik an arbitrary row.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data (or a couple of examples of acceptable results).
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.

Similar Messages

  • How to create Dynamic Table with more than one column?

    Hi,
    I'm trying to learn Dreamweaver. I'm trying to display 2 units from my database in the same row then I would like go to next row.
    By default DW shows single record in each row. Is it possible to display more than one?
    Thank you

    Of course. You will not name the divs differently, they will all be <div class="RowContainer">  (in the example below) and the reason they will look like
    1 2
    3 4
    5 6
    is because they will "stack themselves up". That is, the first will float to the top left, the next will float up next to it. The third will not fit on the top line floating next to two, so it will start a new row. Four will float up next to it, and five will start the new row.
    Think of the string of divs (don't put wordspaces between them...) as a continuous ribbon or chain of divs. That is a slightly poor analogy, since the second and third won't be next to each other, as a chain or a ribbon might be. But you should be able to have as many divs as you have records... you define the div in the CSS and in your page markup really only show one div.
    Here's a modified example from one of my files:
    <div spry:region="ds1" class="...">
      <div spry:repeat="ds1" class="RowContainer"> <!--this is the div that you would style to float -->
        {category} {title} {medium}<br>
         {price} {sold} {date}<br>
         {sold_to_purchase_price}
      </div>
    </div>
    Beth

  • Can i record with more than one audio interface

    I need to record 16 tracks, I have two different audio iterface, in GarageBand i can only find one of them, if i go to prefrenses-audio, I can set any of them as my audio interface, but only one at the time.
    Any tips to how I can use bouth simultanious? Cubase, Logic mabye, GarageBand no can do? :-)

    josteinfromoslo wrote:
     can i record with more than one audio interface
    yes, create an aggregate device:
    http://www.bulletsandbones.com/GB/Tutorials.html#allaboutaggregatedevices
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    josteinfromoslo wrote:
    I need to record 16 tracks
    GB can only record 8 tracks at a time, however that is 16 channels, so with some extra effort you can get the outcome you desire, see the second tip here:
    http://www.bulletsandbones.com/GB/TricksHacks.html

  • How to create combobox to display more than one columns

    I need kind help with the following question. As the combobox includes two pieces--textbox and the combobox list. Then how to create a combo box bean, which is based on table EMP(empno number(6), ename varchar2(40)) records for example, to achieve these features:
    1) allow more than one columns to be displayed in its records list--e.g., I need to show these records:
    empno (value) ename (label)
    103 David M Baker
    104 David M Baker
    105 Kelly J Volpe
    106 Krista F Carpenter
    107 Michelle P Silverman
    The two 'David M Baker's are different employees, but unfortunately, with the same name.
    2) allow combo box list to return the column value 'empno' even though it shows both columns as above. i.e., if user picks the second record above, then the combobox list returns 104 to the textbox in the background, but the 'David M Baker' is displayed on the textbox. Of course the combobox list may return 'David M Baker' if needed when there is only one column in the list as the current standard feature.
    3)allow partial match search by typing in some letters. i.e., if user types in the textbox of the combobox letter 'K' or 'k' then the partially matched records
    105 Kelly J Volpe
    106 Krista F Carpenter
    should be automatically displayed in the combobox list, not the whole list as above; then user may double click to choose one of the two or if user continues to type in 'R' or 'r', then the uniquely matched record 'Krista F Carpenter' is displayed in the textbox and the 106 is returned to the textbox.
    4) as a bonus if it's doable, allow combobox to return values to different textboxes when its records list has more than one columns.
    The reason I need these features is that I am working on the project migrated from Microsoft Access applications to centralized Java version web application. We at beginning promised to users community that Java swing will provide all the GUI user friendly features Microsoft Access has, but now we got stucked--we ate our words and got tons of complains from our users community. This is just the most needed component I posted here. I really hope that Java would add all the default GUI user-friendly features to compete with MS since its Win95 GUI has been accepted as industry standard. And most users are used to it. They claimed that they don't know and don't care what tool you use the newly created application should be more user friendly, not the opposite.
    I would be very much appreciated if any one would help me with this item.

    Thanks for your comments. I think nobody expects Sun to write everything including special features for its components. But I do think Sun should provide at least those standard user-friendly features for the GUI components because most users have been used to the GUI user-friendly features provided by Win95 and Access/Excel applications. Then this will help us to productively create applications to beat MS applications.
    Other wise like me, to get the existing GUI features, existed in old MS Access application, for our migrated Java application, I must re-create the GUI components library first which is a big burden to me at least, for others it might be fun for coding on their own from scratch, but I have to focus on the timing of project.
    If you really can pass the request to Sun and push them move a bit, please pass these words: before Sun starts to revise them, please play around window GUI, e.g., Access/Excel applications, then plan what to do, the bottom line is to equally match or better than them in FUNCTIONALITY(Look and feel is not my focus here). Don't ignore the influence of Windows regardless of you hate it or love it, the reality is most users are so familiar with windows GUI features which are accepted as industry standard. Thus the choice is to match or better to beat them. Don't make your car by closing your door, don't assume users will like what you come out in a closed room.

  • How to create a theme with more than one master-slide size defined?

    I would like to create a Keynote theme that has more than one size of page defined - for example one for on-screen show, and one for printing.
    I noticed that the stock themes, and those from theme vendors, come with multiple page dimensions, and that the master slide layouts for the 'same' master slide appear to be designed differently for the different sizes.
    How do I create themes like this in Keynote? I cannot find any information about this in the Keynote manual. I have worked out how to change the master slide dimensions, but not how to tell Keynote that the layout I've created for a slide is for a particular set of dimensions. So when I look at my theme in the theme browser, I only see the dimensions I had selected last time I saved my theme showing.
    Any help most appreciated.

    The same reason that Apple and 3rd Party vendors put multi-size templates in one file I expect. I am trying to construct an in-house standard template for use in our company, and it is easier to manage if there is only one file to send to people rather than many - both initially and for subsequent edits / updates to the template.
    Of course it would be possible to create several templates (one for each size). But since it is clear that templates can be combined, it appears sensible to do this - unless the doing of it is horridly complicated

  • How to create new user with more than one default folder

    hi
    A new user created in OCS has only one default folder(Inbox).
    I want to create new user with customized default folder.
    for example:
    a new user has more than one default folder(Inbox,Outbox,Draft,Dustbin...)
    And also I want to automaticly enable the functions:
    When sending messages, place a copy in Outbox
    Keep message drafts in Draft
    Move deleted messages to Dustbin
    who know that?
    thanks

    The same reason that Apple and 3rd Party vendors put multi-size templates in one file I expect. I am trying to construct an in-house standard template for use in our company, and it is easier to manage if there is only one file to send to people rather than many - both initially and for subsequent edits / updates to the template.
    Of course it would be possible to create several templates (one for each size). But since it is clear that templates can be combined, it appears sensible to do this - unless the doing of it is horridly complicated

  • How to remove calendar syncing with more than one calendar?

    I have no idea how I did it, but my Blackberry Curve 8310 somehow synced with TWO calendars.  I always had it syncing with my Outlook one and that still works fine, but somehow it also synced to my Hotmail calendar somewhere along the way - but I haven't used that calendar in a very long time and don't even use my Hotmail account anymore, so it's just confusing everything.  I never meant to tell it to sync to that one and for the life of me I can't figure out how to get it to remove all that calendar info that it added!  Can someone help with instructions?  I'm fairly technically savvy, I just can't figure out how to do it on my own.

    Do you want to remove the hotmail account all together? If so you can delete it from either your carrier's BIS page, or from the personal email setup icon on your device.
    If you just want to remove the calendar try going to Options | Advanced Options | Service Book. Find your Hotmail account's CICAL service book and delete it
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • SQL to convert rows with more than one columns to columns

    Hi All,
    I have a typical question here. As must have been in most of the recent databases, the attributes of a master table are put in a child table. So an SQL query will return multiple rows with each row having each attribute.
    Eg: Object OBJ has 5 attributes - A, B, C, D, E. The tables would be
    TABLE OBJ
    ======
    OBJ_ID (PK) (Say ID1)
    OBJ_COL1
    OBJ_COL2
    TABLE OBJ_CHILD
    ========
    OBJ_CHILD_ID (PK)
    OBJ_ID(FK)
    ATTRIBUTE (The data will be A,B,C,D,E for each OBJ_ID)
    ATTRIBUTE_VALUE (Value for each attribute. say 1,2,3,4,5)
    Query : SELECT OBJ_ID, ATTRIBUTE, ATTRIBUTE_VALUE FROM OBJ < OBJ_CHILD where OBJ.OBJ_ID = OBJ_CHILD.OBJ_ID
    This will return 5 rows as :
    OBJ ATTRIBUTE ATTRIBUTE_VALUE
    === ======== =============
    ID1 A 1
    ID1 B 2
    ID1 C 3
    ID1 D 4
    ID1 E 5
    I need to return rows as follows:
    ID1 A 1 B 2 C 3 D 4 E 5
    Is this thing possible in SQL? Even with a function ? (Its a transpose but with two columns in every row)
    Thanks,
    Midhun.
    P.S. I am on Oracle 10g.

    Hi
    user8830587 wrote:
    ... I need to return rows as follows:
    ID1 A 1 B 2 C 3 D 4 E 5How many columns is that?
    If it's 11 or 12 separate columns, then look for Pivot .
    If it's 2 or 3 columns (where the last one is all the data from obj_child concatenated together), then look for String Aggregation .
    Either can be done with any number of columns.
    If you have a choice, you'll probably want to do string aggregation rather than pivot.
    If you'd like help, post a little sample data (CREATE TABLE and INSERT statements) for both tables.
    Also post the results you want from that data, clearly formatted to show the columns. When you post formatted text on this site, type these 6 characters:
    \(all small letters, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    Edited by: Frank Kulash on May 14, 2010 6:26 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to generate a report with more than one elements in the same graph??

    I need to generate a custom report in OEM GC 10g featuring volume total capacity information and volume free capacity information both in the same graph on (Y-axis) and time on the (X-axis). I could generate only the total volume capacity graph individually, but how can the combined graph and the graph for free capacity be generated...

    Is it your values in parameter NO separated by coma? And is it
    parameter in where clause?
    Do you want something like :
    from table
    where s_no in (NO) ?
    If is answer "yes" you can create lexical parameter in report.
    You can write in report sowething like:
    select a.field1, a.field2,.....
    from table a
    &COND /* this is if is condition only one line after "from".
    if you have more lien after where then you will put this &COND
    in line where you want to have your multivalue.
    Then in your trigger in form you should write:
    sc_no := 'where a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    /* again this is if you have only one line with WHERE ili
    conditions */
    or you will write:
    sc_no := 'and a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    It will substitute line in which is your conditions with
    multivalue.

  • How to pass a parameter with more than one value to a report? (urgent)

    Hi, all
    I try to pass a parameter from a search form to a report in
    which I would like to print out my search result. My problem is
    I can pass the parameter to report but only one value which my
    cursor points to. could anyone tell me how to pass a list of
    value to the report? my trigger in form like this:
    declare
    PL_ID PARAMLIST;
    sc_no books.c_no%type;
    begin
    PL_ID := GET_PARAMETER_LIST('parametername');
    IF NOT ID_NULL(PL_ID) THEN
    DESTROY_PARAMETER_LIST(PL_ID);
    END IF;
    PL_ID := CREATE_PARAMETER_LIST('parametername');
    IF ID_NULL(PL_ID) THEN
    MESSAGE('PL/SQL held against Button failed to execute');
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    ADD_PARAMETER(PL_ID, 'PARAMFORM', TEXT_PARAMETER,'NO');
    sc_no := :searchlist.c_no; --(c_no is the value I want to pass
    but not only one.)
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    RUN_PRODUCT(REPORTS, 'reportpathname.rep', SYNCHRONOUS, RUNTIME,
    FILESYSTEM, PL_ID, NULL);
    end;
    Thank you in advance
    Diana

    Is it your values in parameter NO separated by coma? And is it
    parameter in where clause?
    Do you want something like :
    from table
    where s_no in (NO) ?
    If is answer "yes" you can create lexical parameter in report.
    You can write in report sowething like:
    select a.field1, a.field2,.....
    from table a
    &COND /* this is if is condition only one line after "from".
    if you have more lien after where then you will put this &COND
    in line where you want to have your multivalue.
    Then in your trigger in form you should write:
    sc_no := 'where a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    /* again this is if you have only one line with WHERE ili
    conditions */
    or you will write:
    sc_no := 'and a.sc_no in ('||:searchlist.c_no||')';
    ADD_PARAMETER(PL_ID, 'pamametername', TEXT_PARAMETER, sc_no);
    It will substitute line in which is your conditions with
    multivalue.

  • BizTalk:How to share customized pipeline with more than one BizTalk Application

    I have a new BizTalk application which will use a customize generic pipeline . This pipeline has been used in an existing BizTalk application.
    When I use BizTalk Server Administration to add this pipeline assembly as a resource for a new BizTalk application, it shows error message: "this biztalk assembley has already in store and is either associated with another application or another type".
    My questions is how to share the generic pipeline component with many BizTalk application?
    Many Thanks.

    Hi,
    If you plan on using the deployed pipeline across multiple applications in BizTalk you have two options:
    1) The Current Application (in BizTalk Server Administration Console) should have the other application [where the pipeline
    is deployed] as reference.
    right click the "Current Application" and select "Properties"
    on the "Properties" page, left hand side, select "References"
    On the right-hand side, use "Add" to add the "Other Application" as a reference.
    Refer: How
    to Add a BizTalk Assembly to an Application
    Doing so will ensure that ALL resources (maps, schemas, orchestrations, send ports, receive locations, rules, etc.) deployed
    for "Other Application" are available/reprehensible in "Current Application".
    2)  Create a common BizTalk application on BizTalk Admin Console and add your custom pipeline assembly in that new application
    as a resource. With this, you don't need any other application to be started apart from this common application. Any other application who wants to use this pipeline will refer this common application.
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • Sorting items in a region with more than one column

    I have an item region that is set up to have 2 columns. When I sort by title, the items are re-sorted in alphabetical order from left to right and then down. This is not very intuitive. Is there a way to have it sort from top to bottom and then left to right so that they will be in order as you read down a single column? Right now my work around is to create two regions without banners side by side and then manually put the items in order. Thanks.

    hi,
    unfortunately you cannot change the sort order in a way that the items are first sorted down on the first column and then continued in second column.
    regards,
    christian

  • GROUB BY with more than one column

    I (who is not very good at SQL) was explaining GROUP BY clause in SQL to my beginner colleague . I showed him an example where results are grouped for one column . Something like
    select customer, count(*) as ItemCount
    from Orders
    group by customerCould you guys give us a meanigful, simple and easy to remember example where two columns are being grouped

    Hi Zebra,
    Got this example from Google
    DROP TABLE myenterprise;
    CREATE TABLE myenterprise(
    city VARCHAR2(10),
    storeid VARCHAR2(10),
    month_name VARCHAR2(10),
    total_sales NUMBER);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'January', 1000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'March', 7000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'April', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id2', 'November', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id3', 'January', 5000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'Janaury', 3000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'August', 6000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'September', 500);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'November', 1000);
    -- GROUPing of one column (which you already have)
    SELECT city, SUM(total_sales) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    -- Two columns making up a group
    select city, month_name, sum(total_sales) as total_sales_per_city
    from myenterprise
    group by city, month_name
    order by total_sales_per_city desc;

  • Send email from SAP with more than one attachment

    Hi all,
    How can i send email with more than one attachment and different types of document(doc,pdf,etc.) from SAP to external?
    Besr regards,
    Munur

    Hi,
    I use :
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    the main problem with different attachemts is to genereate the packing_list.
    the packing list is a kind of description of the data table... where ist the start  of an image, end, size...
    "Creation of the entry for the compressed attachment
            objpack-transf_bin = 'X'.                    " it could be an image
            objpack-head_num = lv_head_num_count .  " inital 1 each att  add 1
            objpack-head_start = 1.                     " fix
            objpack-body_start = gv_startnum.    " table with attachments  1. line one
            objpack-body_num = tab_lines.          " how many lines are in the table of attachment
            objpack-doc_size = tab_lines * 255.   " size of the  attachment...
           objpack-doc_type = lv_typ . " 'JPG'.
            objpack-obj_name = 'ATTACHMENT'.
            objpack-obj_descr = lv_stripped_name  " name of the JPG
       APPEND objpack.
       APPEND LINES OF lt_goscontent TO gt_maildata.  " data Table...
    bestreg
    robert

  • Get the data with more than one of the desired value

    Hi,
    I need to pull the records with more than one value of 'Other' on the delivery days fields.
    The delivery fields are mon,tue,wed,thu,fri and sat that tells the where the item will be delivered. The value can be Home, Work, or Other.
    Here is the Sample data:
    cust_id: 123
    item: newspaper
    mon: Home
    tue:Work
    wed: Other
    thu: Home
    fri: Other
    sat: Other
    And here is my query so far.
    select
    cust_id,
    item,
    mon,
    tue,
    wed,
    thu,
    fri,
    sat,
    sum(case when (del_mon = 'O' or del_tue ='O' or del_wed ='O' or del_thu ='O' or del_fri ='O' or del_sat='O') then 1
    else 0 end) as day_ctr
    from customer
    Could you please help me with the right formula I need to get this?
    Thank you in advance..

    First
    DESC customer
    Second
    Can you explain what you are trying with
    sum(case when (del_mon = 'O' or del_tue ='O' or del_wed ='O' or del_thu ='O' or del_fri ='O' or del_sat='O') then 1 else 0 end) as day_ctr
    Third
    Usually it's helpful a example of the result you want...
    Perhaps you want this
    select DECODE(mon,1,(select distinct mon from customer), 'OTHER') mon,
            DECODE(tue,1,(select distinct tue from customer), 'OTHER') tue,
            DECODE(wed,1,(select distinct wed from customer), 'OTHER') wed,
            DECODE(thu,1,(select distinct thu from customer), 'OTHER') thu,
            DECODE(fri,1,(select distinct fri from customer), 'OTHER') fri,
            DECODE(sat,1,(select distinct sat from customer), 'OTHER') sat from
    select
    COUNT(DISTINCT mon) mon,
    COUNT(DISTINCT tue) tue,
    COUNT(DISTINCT wed) wed,
    COUNT(DISTINCT thu) thu,
    COUNT(DISTINCT fri) fri,
    COUNT(DISTINCT sat ) sat
    from customer
    )

Maybe you are looking for