How to merge values into a line, based on distinct values in another column

I have a table like

updatedby updateddate text
Approval John 1st May 2009 1 added file
Approval of John 1 May 2009 2 added file
May 2, 2009 1 deleted David approval form

I need the text column values to be concatenated and displayed for unique (updatedby updateddate) records. The output is something like

updatedby updateddate text
Approval of May 1, 2009 John save further approval 1 sheet, 2 added
May 2, 2009 1 deleted David approval form

I had planned to do it using PLSQL. Is there a way to achieve this in SQl...? Please suggest
SQL> ed
Wrote file afiedt.buf

  1  with t as (select 'John' as updatedby, to_date('01-May-2009','DD-MON-YYYY') as updateddate, 'Approval record 1 added' as text from dual union all
  2             select 'John', to_date('01-May-2009','DD-MON-YYYY'), 'Approval record 2 added' from dual union all
  3             select 'David', to_date('02-May-2009','DD-MON-YYYY'), 'Approval record 1 removed' from dual)
  4  -- END OF SAMPLE DATA
  5  --
  6  select updatedby, updateddate, ltrim(sys_connect_by_path(text,','),',') as text
  7  from (
  8    select updatedby, updateddate, text, row_number() over (partition by updatedby, updateddate order by text) as rn
  9    from t
 10    )
 11  where connect_by_isleaf = 1
 12  connect by rn = prior rn+1 and updatedby = prior updatedby and updateddate = prior updateddate
 13  start with rn = 1
 14* order by 2
SQL> /

UPDAT UPDATEDDA TEXT
----- --------- ----------------------------------------------------------------------------------------------------
John  01-MAY-09 Approval record 1 added,Approval record 2 added
David 02-MAY-09 Approval record 1 removed

SQL>

Edited by: BluShadow May 21, 2009 12:37
Argh! hair to the pole by SY

Tags: Database

Similar Questions

  • I have a column with two values, separated by a space, in each line. How to create 2 new columns with the first value in a column, and the second value in another column?

    I have a column with two values, separated by a space, in each line. How do I create 2 new columns with the first value in one column and the second value in another column?

    Add two new columns after than the original with space separated values column.

    Select cell B1 and type (or copy and paste it here) the formula:

    = IF (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')

    shortcut for this is:

    B1 = if (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')

    C1 = if (Len (a1) > 0, Member SUBSTITUTE (A1, B1 & "", ""), "")

    or

    the formula of the C1 could also be:

    = IF (Len (a1) > 0, RIGHT (A1, LEN (A1) −FIND ("", A1)), "")

    Select cells B1 and C1, copy

    Select cells B1 at the end of the C column, paste

  • Column sum based on a single value of another column

    Hi all

    I've searched and searched, but just can't find if this is even possible, let alone how to do it.  What I'm trying to do, it's the sum of a column.  However, only summarize the results of this column if a specific value of another column is present.  So, for example, the following is a sample database entry:

    Rate of pay hours

    2.3                                  $14.00

    1.2                                  $14.00

    2.4                                  $12.50

    0.75                                $12.50

    So for that, I want the sum of hours worked column but only the sum of hours worked if the wage rate is $14.00 and $ 12.50.  Because these numbers are generated in a database (with the various people who enter multiple rates of pay), I won't be able to set the where statement to have a specific amount (since I don't know the specific amount each registrant), the amount must be a variable in the where the statement.  With MySQLI, I know not how to make the sum of hours worked, but I do not know how the sum of hours worked if and only if the line corresponds to the unique value in the rate column.

    Then have it automatically loop through and total hours worked for other unique values in the column salary rate.  Finally, out all unique values in the column rate in variables so that I can do the following for each game:

    $total1 = $total_hours1 * $wage_rate1
    $total2 = $total_hours2 * $wage_rate2
    $overall_total = $total1 + $total2
    

    where $wage_rate1 = $14.00 and $total_hours1 = 2.3 + 1.2: etc.

    Is it still possible?  If so, how?  If possible, can someone please let me know a good reference so I can learn how to be the best way to implement?

    Thank you

    So with that, I get the correct $final_total printed, but I still get the error, 'notice: Undefined variable: final_total. Why is it not defined, but prints the total exact? How to remove the error?

    You get this notice is because you use the assignment combined, operator that is normally used to add a value to a variable and assign the new value to it.

    $final_total += $total;

    is a shortcut for this:

    $final_total = $final_total + $total;

    The undefined $final_total is on the right side of the assignment operator. The first time through the loop, you add $total to a non-existent value. Because of the type of PHP juggling, this becomes:

    $final_total = 0 + $total;

    The next time the loop runs, $final_total has a value, so that you get the view variable not defined only once.

    To avoid advice, initialize $final_total to zero before the start of the loop.

    $final_total = 0;

    While ($row = {$sql-> fetch_array())}

  • Add column if the value in another column

    How can I add a column as column name 'YES_OR_NO.

    SELECT VALUE_ID IN THE TABLE TABLE_NAME

    VALUE_ID
    ---
    1
    2
    3
    4
    5

    Now, I want to create another column in the sql query called YES_OR_NO and that if there is a value in VALUE_ID then column YES_OR_NO must say 'YES' if there is no value in the column VALUE_ID of this line YES_OR_NO must say 'NO '.

    or just a way for her also to work would be to show this new column or not if a value in another column of table_name_2 (this would be ideal)
    If new column yes_or_no and fill by a Yes or a no if a value is found in another table

    Assuming that you are on a version that supports the CASE expression:

    SELECT VALUE_ID
          , case when VALUE_ID is null then 'NO' else 'YES' end as YES_NO
    FROM TABLE_NAME
    
  • Amount based on certain letters in another column values

    Hello

    1. I would like to help to design a formula that sums values based on the presence of "coding" letters in another cell.

    Basically, I have an information line that contains several different values in individual columns. Then, I want to have a cell "coding" that relates to that particular line, when I hit a certain letter or more likely letters. These letters say provide more information on the values of the row. I want to summarize some columns that depends on the presence of certain letters in the "coding" cell, but my current use the SUMIF formula (e.g. SUMIF (g4:g6, "m =", A4: A6 "totals only values in A4: A6, if ONLY the letter am' is located in g4:g6 - while I need the formula for hunting the letter'm ' even if there is no other letters in the same cell with him - for example g6 cells which")) contains 'Sir'

    2. in addition, I would like to have the spreadsheet sum up occurrences of places (frequency) and sales of each place. I have maybe up to 40 locations to manage - so, how do I write a SUMIF formula that takes everywhere? Should be a long embrace formula that lists all of the 40 locations?

    I hope someone can help!

    Thanks in advance

    Matthew

    PS - It's just a spreadsheet example - real is normally 100 long lines for each month, so I have to get as automated as possible summary functions!

    You can use wildcards in SUMIF and SUMIFS, like this:

    = SUMIF(G,"*m*",A)

    BTW, your layout seems very "Excel-like". Suggest that you break your table to enjoy the design of the numbers. Here, my tier 6 is defined as a footer line.  This way I can simply reference to column G without worrying about which define a particular range.

    SG

  • How re - number values in a column...?

    Hello

    So I values in a column as a column looks like this...

    Employee_id
    ------------------
    72
    73
    74
    75
    76
    100
    30 s
    102
    103
    108
    121 of... and so on...


    What I want to do is to renumber these so that they become

    Employee_id
    ------------------
    1 (previously 72)
    2 (previously 73)
    3 (previously 74)
    4 (previously 75)
    5 (previously 76)
    6 (against 100)
    7 and so forth...
    8
    9
    10
    11
    12


    any ideas on this can be reached?


    Thank you!

    Hello

    No it's not got the foreign keys and this isn't the primary key...

    In this case, you should be able to MERGE, also:

    SQL>create table test(pk_column number primary key
      2                   ,emp_id number not null unique);
    
    Table created.
    
    SQL>
    SQL>merge into test t
      2     using (select row_number() over (order by emp_id) new_id, pk_column
      3              from test) s
      4     on (t.pk_column = s.pk_column)
      5     when matched
      6     then
      7        update set t.emp_id = s.new_id;
    
    0 rows merged.
    
    SQL>
    

    Concerning
    Peter

  • How to capture value of table column-level changes using oracle 11g steamed

    How to capture the value of the column of table changes using oracle 11g steamed. (similar to the audit).
    Oracle made the steam would be the best way to do the same.
    Please notify. Please give me a code example.

    user4485803 wrote:
    How to capture the value of the column of table changes using oracle 11g steamed. (similar to the audit).
    Oracle made the steam would be the best way to do the same.
    Please notify. Please give me a code example.

    Look at the change data Capture

  • How do rotate on a date and see the sum of the value of another column

    Hello

    I searched through the forum and cannot find a query similar to my question feels so post this new thread.

    First of all, it is probably useful indicating that I am using Oracle 10 g.

    I have a table that is used to store the details of the booking (essentially a booking system) and I would use this data to display the details of the customers stay on one line.

    The table has the following columns:
    BOOKING_ID
    CUSTOMER_ID
    DATE_OF_ARRIVAL
    NUMBER_OF_NIGHTS
    NUMBER_OF_PEOPLE
    Some example records could be:

    BOOKING_ID    CUSTOMER_ID     DATE_OF_ARRIVAL    NUMBER_OF_NIGHTS   NUMBER_OF_PEOPLE
    --------------------------------------------------------------------------------------------
    1                    201      13-JAN-2010        5                   1
    2                    202      13-JAN-2010        3                   2  
    3                    202      13-JAN-2010        4                   1
    4                    203      15-JAN-2010        2                   3
    On this basis I would like to display the output so that I can show a sum of the NUMBER_OF_PEOPLE reserved to per customer per day, as such:
    CUSTOMER_ID     13-JAN   14-JAN   15-JAN   16-JAN   17-JAN   18-JAN   19-JAN 
    -----------------------------------------------------------------------------------------
    201                   1       1        1        1        1        0        0
    202                   3       3        3        1        0        0        0
    203                   0       0        3        3        0        0        0
    I watched analytical functions in the documentation and several books of Oracle that I have, but have so far struggled to find how to make the performance desired. Even using the excellent response to the previous post on the forum, I got Re: how to count the occurrence of a date in a range I was not able to get a feasible request.

    Any help or advice would be much appreciated.

    Kind regards
    Stu

    Published by: macmanxie on January 10, 2011 21:16

    Hello

    macmanxie wrote:
    ... The suggested approach goes only to return a number if the DATE_OF_ARRIVAL corresponds to the date in the CASE statement, however I have the added complexity of wanting to show a count of all the days that the customer is booked, for, by making use of the NUMBER_OF_NIGHTS. I tried to use some of the examples provided on morganslibrary.org, for example:

    sum( CASE WHEN  TRUNC (arrival_date) between '01/13/2011' and TRUNC (arrival_date+no_of_nights) THEN nvl(no_of_people,0) ELSE 0 END) AS jan_13
    

    but this does not produce the desired result.

    You check if arrival_date is between January 13 and arrival_date + no_of_nights (as if the arrival date could all be posterior to the arrival_date + no_of_nights).
    Are not really interested in whether or not January 13 ib between arrival_date and arrival_date + no_of_nights?

    NVL ( SUM ( CASE
                    WHEN  TO_DATE ( '01/13/2011'
                           , 'MM/DD/YYYY'
                         )          BETWEEN  TRUNC (arrival_date)
                             AND       TRUNC (arrival_date) + no_of_nights
                 THEN  no_of_people
             END
           )
        , 0
        )          AS jan_13
    

    Always format your code. It is important to format your code if you are the only who who will ever read but it is even more important if you are posting on a forum like this and ask other people to read.
    Not to compare the DATEs in the strings; explicitly use a conversion function, like TO_DATE, above, where necessary.
    Both
    SUM (NVL (x, 0)) and
    NVL (SUM (x), 0) get the same results, but the latter is more effective. If you have 1000 lines, the first way is calling NVL 1000 times, but the second way is calling only once.

    If your previous thread
    Re: How to count the occurrence of a date in a range
    Gets you the right data, but it has one row for each distinct combination of customer_id and date, then you can switch it to a form that contains a line by the customer and another column for each date.

    If you need help, post CREATE TABLE and INSERT statements for some examples of data and outcomes from these data. The post you are trying better to a request, including a subquery that gets no cross-the raw table dynamic results.
    There will be a fixed number of columns in the output swing? If this is not the case, how do you deal with that? Which of these options in the thread I posted above)
    Re: County report and the sum of the number of rows by multiple columns
    ) is best for your needs? Than others is acceptable?

  • Add multiple column values in another column

    Hello

    I have a table with structure below

    Date of the transaction Country Division of Entity Flag Total
    January 5, 2015GB11CRNews errors5
    January 5, 2015GB11PassNews errors5

    I need to display it in below format

    Date of the transaction Country Division of CR-news mistakes Spend-news mistakes Total-news mistakes
    January 5, 2015GB115510

    If you see the above format, I want the lines had to be transposed to the columns that depends on the value of the INDICATOR. A flag as 'New errors' entry will have a multiple entity (Cr, spend)

    On this basis, we must for the Date of the Transaction, country, Division of the Group and display the data.

    Sum of the total errors in a specific indicator should be displayed in a column.

    I tried under query to convert the columns.

    Select t.transaction_dt, t.cntry_id, t.div_id,

    NVL ()max()decode(t.entity | ) '-' : t.Flag, ' CR-news mistakes ' , t.TOTAL)),0) 'CR-news mistakes',

    NVL ()max()decode(t.entity | ) '-' | t.Flag,'Spend -new errors , t.TOTAL)),0) 'Autori-news mistakes'

    table t

    Group of t.transaction_dt, t.cntry_id, t.div_id;


    In the above how to get the sum total columns for this type of query hint.

    Help, please.

    Something like this maybe?

    SELECT transaction_dt,

    cntry_id,

    div_id,

    Sum(case when Entity = 'CR' and Flag = 'New Errors' Then total else 0 end) CR_New_Errors,

    Sum(case when Entity = 'Spend' and Flag = 'New Errors' Then total else 0 end) Spend_New_Errors,

    Sum(case when Flag = 'New Errors' Then total else 0 end) Total_New errors

    -... etc for all other combinations of flag and entity...

    From your_table

    Transaction_dt GROUP, cntry_id, div_id

  • the sum of the column lines based on distinct values of column B

    Hi all
    Here is my xml
    rowset <>
    < ROW >
    < ORDER_NO > 103-4385509 < / ORDER_NO >
    < SITE_NO > 103 < / SITE_NO >
    < ORDER_ID > 4385509 < / ORDER_ID >
    < CUSTOMER_ID > 2676832 < / CUSTOMER_ID >
    < TAX_AMOUNT >.33 < / TAX_AMOUNT >
    < CREATED_DATE > 20/08/2010 < / CREATED_DATE >
    < USER_CREATED > TSDAL671 < / USER_CREATED >
    < Delivery_Method > CARRY OUT STORE < / Delivery_Method >
    < Entered_By > TSDAL671 < / Entered_By >
    < SKU_NO > 321182 < / SKU_NO >
    < NAME_TEXT > MGR_OVERRIDE < / NAME_TEXT >
    < > 319 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    Override < ATTRIBUTE_VALUE > done < / ATTRIBUTE_VALUE >
    < DETAIL_SEQ_NO > 1 < / DETAIL_SEQ_NO >
    < / ROW >
    < ROW >
    < ORDER_NO > 103-4385509 < / ORDER_NO >
    < SITE_NO > 103 < / SITE_NO >
    < ORDER_ID > 4385509 < / ORDER_ID >
    < CUSTOMER_ID > 2676832 < / CUSTOMER_ID >
    < TAX_AMOUNT >.33 < / TAX_AMOUNT >
    < CREATED_DATE > 20/08/2010 < / CREATED_DATE >
    < USER_CREATED > TSDAL671 < / USER_CREATED >
    < Delivery_Method > CARRY OUT STORE < / Delivery_Method >
    < Entered_By > TSDAL671 < / Entered_By >
    < SKU_NO > 321182 < / SKU_NO >
    < NAME_TEXT > OEDTL_TAX_INFO < / NAME_TEXT >
    < > 314 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > 441130760 | 441130760 | 441130760 | 1. 1. 1. 20100820 | 2676832 | 2. SPARE PARTS | < / ATTRIBUTE_VALUE >
    < DETAIL_SEQ_NO > 1 < / DETAIL_SEQ_NO >
    < / ROW >
    < ROW >
    < ORDER_NO > 103-4385509 < / ORDER_NO >
    < SITE_NO > 103 < / SITE_NO >
    < ORDER_ID > 4385509 < / ORDER_ID >
    < CUSTOMER_ID > 2676832 < / CUSTOMER_ID >
    < TAX_AMOUNT >.18 < / TAX_AMOUNT >
    < CREATED_DATE > 20/08/2010 < / CREATED_DATE >
    < USER_CREATED > TSDAL671 < / USER_CREATED >
    < Delivery_Method > CARRY OUT STORE < / Delivery_Method >
    < Entered_By > TSDAL671 < / Entered_By >
    < SKU_NO > 412679 < / SKU_NO >
    < NAME_TEXT > OEDTL_TAX_INFO < / NAME_TEXT >
    < > 314 ATTRIBUTE_ID < / ATTRIBUTE_ID >
    < ATTRIBUTE_VALUE > 441130760 | 441130760 | 441130760 | 1. 1. 1. 20100820 | 2676832 | 2. 0035 | < / ATTRIBUTE_VALUE >
    < DETAIL_SEQ_NO > 2 < / DETAIL_SEQ_NO >
    < / ROW >


    I have to display 3 lines but all the sum of TAX_AMOUNT grouped by ORDER_ID, I need sum for 2 records based on the distinct value of DETAIL_SEQ

    so my output should be something like below

    ORDER_ID | TAX_AMOUNT | DETAIL_SEQ | ATTRIBUTE_ID
    -----------------------------------------------------------------------------
    4385509 | 0.33 | 1. 319
    4385509 | 0.33 | 1. 314
    4385509 | 0.18 | 2. 314
    --------------------------------------
    SUM = 0.51
    ------------------------------------------


    Note: I can't make separate in the sql attribute_id is different for the same DETAIL_SEQ_NO.


    I tired to do <? sum ([xdoxslt:distinct_values (current - group () / DETAIL_SEQ_NO)] / TAX_AMOUNT)? >

    It did not work.

    Can someone help me please!



    Thanks in advance!

    This syntax will not work.

    A method to do so.

     
    
          
     
    
     
    
    
    
  • How to change the color of line based on Condition

    Dear all,

    We have requirment as shown below

    Based on the condition, I want to show the color for all of the line

    Example of

    If attribute = 'Y' then
    {
    < show the color for complete line in advanced table?
    }

    Please give me suggestion how join my requirment.

    Thank you
    Venkat Reddy Pulichintha

    Hey...

    you said that the code you wrote is working for a column... in the same way you can set the CSS Style on all other columns as well...

    Why don't you go with code that works...

    DataBound APIs are an alternative solution to this... you can search on it later...

    Thank you
    Gerard

  • How to highlight a cell IR report based on a value in another column?

    I used the code below and the cell is highlighted for all use column formatting css #COLTOHIGHLIGHT #add to pageBut what I need is if the HIDDENCOL is 'OUT' value and Custom2 should apply if the HIDDENCOL has value 'IN' then custom1 should apply. How to do? Please help thanks loly

    Sinduja Sivasailam wrote:

    Thank you for your contributions. I understand the concern.

    As suggested, I've reproduced the problem in the environment of the APEX.

    Thanks for making the effort. I suggest the following approach, which is more flexible and allows a more efficient use of the separation of concerns as above. I created an example on a new page to illustrate this.

    1. change the report query to

    select
        jan
      , feb
      , mar
      , jan_st
      , feb_st
      , mar_st
    from
        project_status
    

    2. in the report, set the month columns to display text and status columns to be hidden.

    3. set the property Expression of HTML for each column of months to use a HTML data attribute to include metadata status as well as the displayed value:

    #JAN#
    

    4. create a dynamic action after Refresh on the IR region to retrieve the status of project code in the columns of months and apply it as a class to the cell of report element:

    Event: After refresh

    Selection type: Region

    Region:

    Real Actions

    Sequence: 10

    Action: Run the JavaScript Code

    Fire on Page load: Yes

    Code

    $('.a-IRR-table td [data-prj-status]').each(function () {
      var x = $(this);
      x.parent().addClass(x.data('prjStatus'));
    });
    

    5 Add a style sheet to the page of Inline CSS property with a rule to set the background color of cell as required for each State of the project:

    .a-IRR-table tr:hover td {
      opacity: 0.7;
      transition: opacity .1s
    }
    .a-IRR-table td.REQ,
    .a-IRR-table tr:hover td.REQ {
      background-color: #ff9;
    }
    .a-IRR-table td.INP,
    .a-IRR-table tr:hover td.INP {
      background-color: #cf9;
    }
    .a-IRR-table td.YTS,
    .a-IRR-table tr:hover td.YTS {
      background-color: #ccf;
    }
    .a-IRR-table td.CR,
    .a-IRR-table tr:hover td.CR {
      background-color: #f66;
    }
    .a-IRR-table td.COM,
    .a-IRR-table tr:hover td.COM {
      background-color: #9cf;
    }
    
  • Divide a line into several lines based on the amount

    Dear all,

    Please provide a solution for this scenario.

    The query...

    Select line_id, component, sizes, quantity of sales_tab;

    and the result...

    LINE_IDCOMPONENTSIZESQUANTITY
    8BODYSMALL214.33
    4BODYMEDIUM187.89
    1BODYLARGE230.87
    7BODYEXTRA LARGE205.03
    3BODYXX LARGE148,52
    2SLEEVESMALL197.57
    6SLEEVEMEDIUM176.4
    5SLEEVELARGE193.8
    10SLEEVEEXTRA LARGE184.87
    9SLEEVEXX LARGE138.53

    Business rule: for all rows where the quantity is greater than 200, generate a new identical line with quantity = quantity - 200 like - we. This is the quantity of each line must not exceed 200.

    The required result is...

    LINE_IDCOMPONENTSIZESQUANTITY
    8BODYSMALL200
    8BODYSMALL14.33
    4BODYMEDIUM187.89
    1BODYLARGE200
    1BODYLARGE30,87
    7BODYEXTRA LARGE200
    7BODYEXTRA LARGE5.03
    3BODYXX LARGE148,52
    2SLEEVESMALL197.57
    6SLEEVEMEDIUM176.4
    5SLEEVELARGE193.8
    10SLEEVEEXTRA LARGE184.87
    9SLEEVEXX LARGE138.53

    Thank you

    Usman

    Use:

    Select line_id,

    component,

    sizes,

    amount of column_value

    of sales_tab.

    table)

    cast)

    MultiSet)

    Select less (200, - 200 quantity * (level - 1))

    of the double

    connect in quantity > 200 * (level - 1)

    )

    as sys. OdciNumberList

    )

    )

    order of line_id,

    amount desc

    /

    For example:

    SQL > with sales_tab like)
    2 Select line_id 8, component 'Body', 'SMALL' amount 214.33 of all sizes the double union
    3. Select 4, 'BODY', 'WAY', 187.89 double Union all
    4 Select 1, 'BODY', 'LARGE', 230.87 double Union all
    5. Select 7, 'BODY', 'EXTRA LARGE', 205.03 double Union all
    6 select 3, 'BODY', 'XX-LARGE', 148,52 of double union all
    7. Select 2, 'CHANNEL', 'SMALL', 197.57 double Union all
    8. Select 6, 'CHANNEL', 'WAY', 176.4 from dual union all
    9. Select 5, 'ROUND', 'BIG', 193.8 double Union all
    10. Select 10, 'ROUND', 'EXTRA LARGE', 184.87 double Union all
    11. Select 9, 'ROUND', 'XX-LARGE', double 138.53
    12                  )
    13. Select line_id,
    14 components,
    15 sizes,
    amount of 16 column_value
    sales_tab 17,
    Table 18)
    19 mount)
    (20) type multiset
    21 select less (200, - 200 quantity * (level - 1))
    22 double
    23 connect quantity > 200 * (level - 1)
    24                            )
    25 as sys. OdciNumberList
    26                    )
    27              )
    28 order of line_id,
    29 quantity desc
    30.

    LINE_ID COMPON QUANTITY SIZES
    ---------- ------ ----------- ----------
    1 BODY 200 GRAND
    1 BODY GRAND 30,87
    2 SLEEVES SMALL 197.57
    3 BODY XX LARGE 148,52
    4 WAY 187.89 BODY
    5 SLEEVES 193.8 GRAND
    SLEEVE 6 MEANS 176.4
    7 BODY 200 EXTRA-LARGE
    7 BODYWORK 5.03 EXTRA-LARGE
    8 200 SMALL BODY
    8 BODY SMALL 14.33

    LINE_ID COMPON QUANTITY SIZES
    ---------- ------ ----------- ----------
    CHANNEL 9 XX GRAND 138.53
    10 SLEEVES EXTRA-LARGE 184.87

    13 selected lines.

    SQL >

    SY.

  • How to select a value to a maximum value of another column in the same line?

    pVersion pdate pcount
    11 1/6 / 2011 1
    06/11/2011 0, 25
    11 1/6 / 2011 24

    How to select for a maximum pcount pversion, in this case count max is 25 and version will be 0?

    tcode wrote:
    pVersion pdate pcount
    11 1/6 / 2011 1
    06/11/2011 0, 25
    11 1/6 / 2011 24

    How to select for a maximum pcount pversion, in this case count max is 25 and version will be 0?

    WHERE PCOUNT = (SELECT MAX (PCOUNT) FROM TABLE1)

  • How to check multiple values with another column?

    Hi all

    create table xxc_abc (col1 , dept_id number number);

    create the table xxc_bbb (col2 number,sa_dept_id number);

    insert into xxc_abc values (1,10)

    insert into xxc_abc values (2,11)

    insert into xxc_abc values (3,12)

    insert into xxc_bbb values (20.10)

    insert into xxc_bbb values (20,11)

    insert into xxc_bbb values (20,12)

    SELCT

    xxc_abc a.,

    xxc_bbb b

    where a.dept_id = b.sa_dept_id

    Expected results

    a.Col1 b.col2

    ---------  --------

    1 20

    2 20

    3 20

    I need to get several values a.col1 with the same value of the b.col2 column

    a.Col1 b.col2

    ------- ------

    1 20

    2 20

    3 20

    Thank you

    Post edited by: Rajesh123 added Test cases in the main Thread

    Select the number you want to


    with

    xxc_abc as

    (select 1 col1, 10 dept_id in union double all the)

    Select 2,11 Union double all the

    Select double 3.12

    ),

    xxc_bbb as

    (select col2 20, 10 sa_dept_id union double all the)

    Select 20,11 Union double all the

    Select 20,12 double

    )

    Select col1, col2, cnt_all, cnt_not_null, cnt_unique

    from (select a.col1, b.col2,

    Count (*) on cnt_all (b.col2 partition).

    Count (a.Col1) on cnt_not_null (b.col2 partition),

    Count (distinct a.col1) on cnt_unique (b.col2 score)

    xxc_abc a.,

    xxc_bbb b

    where a.dept_id = b.sa_dept_id

    )

    where least (cnt_all, cnt_not_null, cnt_unique) > 1

    order by col1

    COL1 COL2 CNT_ALL CNT_NOT_NULL CNT_UNIQUE
    1 20 3 3 3
    2 20 3 3 3
    3 20 3 3 3

    Concerning

    Etbin

Maybe you are looking for

  • A WiFi sat

    My Wi - Fi is normally a good, fast and powerful connection. I was wondering whether or not I should turn on 'Assistance to Wi - Fi'? Is - it's worth the shot or just a waste of your 3G / 4G?

  • HP (MS-7613) 478-d with ASUS GTX670 DCUII?

    The desktop computer. http://h20000.www2.HP.com/bizsupport/techsupport/document.jsp?ObjectID=c02589909 & lang = to & CC = US & taskI...I know I have to change my diet to 750 watts. But the card mother compatiable with the asus gtx670?ASUS Gtx670 http

  • What two measns of flashing LED?

    I have problem with my E1-530. yesterday when plug-in adapter, then the power led and battery led start blinking and no charge battery. Now I have the AC adapter / CC pluged and still not in charge and running on battery power. Without battery will n

  • Firebird 802 - upgrade hard drives - Solid State / hybrid anyone?

    I'm upgrading hard drives on my Firebird 802 (the part the WEAKEST of my Firebird and the SMALLEST score on Windows Index). I replaced the drive secondary with a Seagate 500 GB SATA drive at 7200 RPM (ST950042 4AS) and REALLY improved performance (I

  • Problems installing Windows Vista Edition Family Service Pack 1

    Windows Update was performed several times, each time trying to install Service Pack 1. Supposedly, it was 6 times with success but never appears in the control panel / system.