How to get the data based on below data-----pls help me...

Hi,
i have the data in my table.......
SET_ID SET_Name Status date user_name
SET974     F698671     I     24/03/2011 10:40:05     TEST1
SET974     F698671     I     24/03/2011 10:40:05     TEST1
SET974     F698671     N     24/03/2011 10:40:05     TEST1
SET974     F698671     I     24/03/2011 10:40:05     TEST1
SET528     A258961     I     22/03/2011 9:40:05     TEST2
SET528     A258961     N     22/03/2011 9:40:05     TEST2
SET528     A258961     I     22/03/2011 9:40:05     TEST2
SET528     A258961     I     22/03/2011 9:40:05     TEST2
SET974     F698671     I     25/03/2011 13:40:05     TEST1
SET974     F698671     N     25/03/2011 13:40:05     TEST1
SET974     F698671     N     25/03/2011 13:40:05     TEST1
SET974     F698671     I     25/03/2011 13:40:05     TEST1
SET974     F698671     I     26/03/2011 15:40:05     TEST5
SET974     F698671     N     26/03/2011 15:40:05     TEST5
SET974     F698671     N     26/03/2011 15:40:05     TEST5
SET974     F698671     I     26/03/2011 15:40:05     TEST5
I want to know each user ,how many sets modified.
based on above input data,my output would be in the following way:
user_name no.of sets upated for single user
TEST1 2
TEST2 1
TEST5 1

Based on your sample data, why does TEST1 have a count of 2? From what I can see, the only SET_ID that is associated with TEST1 is SET974 so I would think that you'd want TEST1 to have a count of 1.
If I ignore the data you posted and just look at the text of your requirements, I would guess that you wanted
SELECT user_name, COUNT( DISTINCT set_id ) cnt
  FROM some_table
GROUP BY user_nameThis won't give the output you said you wanted based on the sample data you provided, however, for the reason I outlined above.
If you actually do expect to get the output you posted from the sample data you posted, can you explain in a bit more detail why TEST1 should have a value of 2? It would also be helpful to post the CREATE TABLE and INSERT statements rather than just dumping the data. If you provide DDL & DML, we can create the objects locally and verify our solutions rather than guessing based on eyeballing the data.
Justin

Similar Messages

  • How to get the previous state of my data after issuing coomit method

    How to get the previous state of some date after issuing commit method in entity bean (It should not use any offline storage )

    >
    Is there any way to get the state apart from using
    offline storage ?As I said the caller keeps a copy in memory.
    Naturally if it is no longer in memory then that is a problem.
    >
    and also what do you mean by auditlog?
    You keep track of every change to the database by keeping the old data. There are three ways:
    1. Each table has a version number/delete flag for each record. A record is never updated nor deleted. Instead a new record is created with a new version number and with the new data.
    2. Each table has a duplicate table which has all of the same columns. When the first table is modified the old data is moved to the duplicate table.
    3. A single table is used which has columns for 'table', 'field', 'data' and 'activity' (update, delete). When a change is made in any table then this table is updated. This is generally of limited useability due to the difficulty in recovering the data.
    All of the above can have a user id, timestamp, and/or additional information which is relevant to the data being changed.
    Note that ALL of this is persisted storage.
    I am not sure what this really has to do with "offline storage" unless you are using that term to refer to backed up data which is not readily available.

  • How to get the past top 100 match data of game app?

    how to get the past top 100 match data of game app?

    What game app? Have you contacted the developer of the app?

  • HT200131 I am trying to enter my network password and when I have entered the password for my network, I don't know how to get the remote to select submit.  Please help

    I bought an apple tv some time back and am only now trying to set up the wireless internet connection.  I can see my network but when I enter the password with the remote, I don't know how to get the remote to submit the password.  Could you please tell me what to do?

    You have to use the right arrow on the remote to navigate all the way and highlight the submit button.

  • How to get invoice price based on order date or delivery date?

    Hi,
    Our system is configured to create invoices with pricing based on date of delivery.
    But we have a number of customers who get pricing based on date of order.
    Right now, people are manually changing the price and then generating the invoice.
    Is it possible to:
    1) add a ZZ field in the customer master that indicates which pricing date to use?
    2) have SAP generate the invoice with the correct pricing date based on this selection?
    Thx.
    Andy Jacobs

    Hi Andrew,
    We do have the exact same problem.
    One solution would be to create a new order type. Within that new type you can specify what date should be proposed as pricing date by SAP.
    Unfourtantely, here we are not able to add a new type. Does anyone know how this can be solved in another way?
    Thanks,
    Tim

  • How to get the Full and final settelment date from PC_payresults

    Hi Experts..sairam.
    We are preparing Functional specification  for a report on Full and final settelement.
    We need to extract the  full and final settelement date from  payresults.
    Full and final settelement would be an offcycle run.
    How can we identify the particular Offcycle is meant for full and final settelment.
    Full and final settelement can be done after date of relieving.
    Please share your ideas to get the field names and logic to fetch.
    Thanks in advance.
    Regards,
    Sairam.

    Hi Praveen,
    I found it from HRPY_RGDIR through SE11.
    But im in confusion in thinking on Logic to find the Full and final settelment processed date.
    First of all..Report has to check WPBP table weather Employment status is Zero.
    Later..It has to read the HRPY_RGDIR table.
    Here what the system to check.What conditions to be validated to fetch the Full and final settelment processed date.Will it be FPPER and INPER as 00000000 or shall we do it from offcycle reason.
    Please share your ideas.Thanks in advance.
    Regards,Sairam.

  • How to update the price based upon PGI date

    Hi
            I have issue of updation of the Prices and freight based on PGI date in the billing we are using the two billing types for the excsies and tax invoice creation .And in the copy control pricing type is maintained Aas "C" for the billing types with single delivery but someHow MRP in the excise billing has been picked from the condition record thats validity is ended and in Tax invoice it picks up the correct prices
    Both pricing condition types has pricing type "B" from Billing date and in the freight we have maintained as "A" SRD
    But for the some cases specially for the excise related part that is based upon the MRP we are facing this issue
    Pricing date is some how coming from sales document
    Please find the problem details in the attachment

    Hi,
    if you see two condition tabs snap shots you can understand clearly because that two invoices has been created in two different dates and you have maintained the pricing date C-billing date ( KOMK-FKDAT).Due to this,the price of ZMRP is coming differently.After you creation of first invoice then you would have changed ZMRP amount.Now while you are creating second invoice ,system has taken new price of ZMRP in billing level.
    Note:While creating second invoice, PGI date might have come into billing level but someone would be changed billing date manually at header level of billing document.Please check that one also.
    Kindly let me know if you need further help on this.
    Thanks,
    Naren

  • How to get the max total sale by date on every store

    I am trying to write a query in Oracle which will return both the store_id and the maximum total sale by date

    Hi,
    Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002
    Hjava wrote:
    I am trying to write a query in Oracle which will return both the store_id and the maximum total sale by date
    Do you mean you want to see the store_id that had the maximum total sale?
    In general, this can be done with a Top-N Query, using an analytic function such as RANK.  For an example, see http://forums.oracle.com/forums/thread.jspa?messageID=3739610
    If you only want the date, the maximum total from that date, and 1 column from the same row with the maximum (e.g. store_id), then you might be able to use the aggregate LAST function instead.
    What results do you want in case of a tie?  (That is, if 2 or mote store_ids have the same total sale on a given date, and no other store_id has a higher total.)

  • How to get the item stock for a date

    Hi all
    I need to get the item stock quantity on a date, but i don´t know if i can get it from a table or if i have to make a query to calculate it from the documents´lines. If you can help me please reply this post.
    Thanks

    Do you already know of table OINM (Warehouse table) - it is not documented in SAP-BO references?
    This table contains entries for each movement in stocks of your system. Here are some examples of fields in this table:
    BASE_REF document number of document affecting OITW.OnHand
    DocDate      date of this document
    ItemCode     Item of which the stock quantity is changed
    Dscription    name of item
    Warehouse  affected stock
    InQty       number of items added into stock (OITW.OnHand is increased)
    OutQty       number of items taken from stock (OITW.OnHand is decreased)     
    TransType   type of booking (see below)
    Balance      this is NOT the OITW.OnHand at the date of this booking;
                      it's something like the cumulated stock value in some currency
    To calculate the OnHand-value at a date of any of these bookings you have to
    sum up the incoming/outgoing quantities, e.g. (z.B. SUM(InQty) - SUM(OutQty)).
    Relation between the type of booking and the values in InQty / OutQty:
      ++ InQty/OutQty contain the number of items added to/taken from the stock;
      the number complies to the value OITW.OnHand is increased/decreased;      
      -- doesn't affect stock (InQty/OutQty = 0)
      ? missing documentation
    TransType InQty OutQty
    -2              ++     --         opening balance
    13      --       --         outgoing invoice
    13              --      ++          outgoing invoice without previous delivery note
    15              --      ++        delivery note
    18              --       --         incoming invoice
    20             ++      --         incoming delivery note
    58             ?        ?          inventory
    59             ++      --         stock receipt (without purchasing transactions)
    60              --      ++        goods issue (without sales transactions)
    67              --      ++        transfer between stocks
    67             ++      --         transfer between stocks
    I hope that I got your question right and that my hints will help you!
    Frank

  • How to get the month value in a date?

    I am retrieving a Date from the database using the getDate() method! However, I want the value of the month in this obtained result, which i want to compare with an integer!
    I dont see any other option but to use the deprecated getMonth() method on this Date object! Or rather get the date as a String & apply the substring methods to get the reqd value!
    Is there any other go on this?

    Hi
    You can use GregorianCalendar.
    Date d = new Date();
    Calendar c = new GregorianCalendar();
    c.setTime(d);
    System.out.println(c.get(Calendar.MONTH)+1);
    -nmw-

  • How to get the table of cost elements data?

    Dear friends,
    I want ot get the Chart_of_Accounts, Cost_Element, Short_Text into an internal table, but how can I find the related tables in SAP system?
    Thanks a lot!

    Hi,
    The table for cost element is  CSKA.
    Alternately you can use the bapi BAPI_COSTELEM_GETDETAIL for getting the details also.
    Regards,
    Ankur Parab

  • How to get the Maximum of two calender dates in OBIEE 11g Analytics

    Hi,
    I have requirement like getting the  maximum calendar date from two calendar dates in obiee 11g reports and  the requirement is like the following
    max(Reported.Calendar date, Returned.Calendar Date)
    can anyone help me to solve this issue.
    Thanks,

    Something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
      2             select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
      3             select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
      4             )
      5  -- end of test data
      6  select c_start_date, c_end_date
      7        ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
      8        ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
      9        ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
    10* from t
    SQL> /
    C_START_D C_END_DAT        YRS      MNTHS        DYS
    17-NOV-06 21-JAN-08          1          2          4
    21-NOV-06 17-FEB-08          1          2         27
    21-JUN-06 17-JUL-08          2          0         26
    SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.

  • How to get the difference between these two dates

    Hello Friends,
    I need to get the difference between these two fields which store dates but with varchar2 data types
    SELECT pac.segment1, pac.segment2 emp_no, pac.segment3 NAME,
    pac.segment4 POSITION, pac.segment5 start_date, pac.segment6,
    pac.segment7
    FROM per_analysis_criteria pac, fnd_id_flex_structures_vl ffs
    WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
    AND ffs.id_flex_num = pac.id_flex_num
    AND TO_CHAR (TO_DATE (pac.segment7, 'YYYY/MM/DD HH24:MI:SS'))
    - TO_CHAR (TO_DATE (pac.segment6, 'YYYY/MM/DD HH24:MI:SS')) > 1;
    my query is something like this...
    am trying to find the difference between the last two columns but with not much luck..
    can some one suggest me a solution please

    SELECT pac.segment1, pac.segment2 person_id, pac.segment3 NAME,
    papf.employee_number, paaf.supervisor_id, pac.segment4 POSITION,
    pac.segment5 start_date, pac.segment6, pac.segment7,
    papf2.email_address,
    ( TO_DATE (TO_CHAR (pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')
    - TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')
    + 1
    ) difference,
    POST.email_address
    FROM per_analysis_criteria pac,
    apps.fnd_id_flex_structures_vl ffs,
    per_all_people_f papf,
    per_all_assignments_f paaf,
    per_all_people_f papf2,
    (SELECT email_address, person_id
    FROM per_all_people_f
    WHERE person_id IN (
    SELECT person_id
    FROM per_all_assignments_f
    WHERE position_id IN (SELECT position_id
    FROM per_positions
    WHERE NAME LIKE 'HR Manager.704.')
    AND TRUNC (SYSDATE) BETWEEN effective_start_date
    AND effective_end_date)
    AND TRUNC (SYSDATE) BETWEEN effective_start_date AND effective_end_date
    AND business_group_id = fnd_profile.VALUE ('PER_BUSINESS_GROUP_ID')) POST
    WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
    AND TO_CHAR (papf.person_id) = pac.segment2
    AND ffs.id_flex_num = pac.id_flex_num
    AND TRUNC (SYSDATE) BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND papf.current_employee_flag = 'Y'
    AND papf.person_id = paaf.person_id
    AND TRUNC (SYSDATE) BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    AND papf.person_id = paaf.person_id
    AND papf2.person_id = paaf.supervisor_id
    AND paaf.primary_flag = 'Y'
    AND TRUNC (SYSDATE) BETWEEN papf2.effective_start_date
    AND papf2.effective_end_date
    AND papf2.current_employee_flag = 'Y'
    and ( TO_DATE(to_char(pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')-TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')+1) >1
    last line is giving me the error pls suggest a solution

  • How to find the Sum based on Like Dates

    Hello everyone,
    Column 1 contains "Date Sent", Column 2 contains "Dates of Service" and Column 3 contains the payment "Amount" in USD. I want to write a formula that will total up the sum of payment values from column 3 based on the date of payment (Column 1).
    Thanks!
    Jared

    Hi Jared,
    This will do what's illustrated in your example, but has a few restrictions:
    The dates must run in ascending order.
    To get a total for the last date, a later date (with no corresponding amount) must be entered after the last transaction.
    Formula:
    Entered in D2, and filled down the rest of column D:
    =IFERROR(IF(A3>A2,SUMIF($A,A2,C),""),"")
    IFERROR is used to suppress the error message that arises from the formula in D10 referencing a cell in D11.
    Regards,
    Barry

  • How to get the freight based on the order value

    Hi Folks,
    I have a scenario..if the total order value is less than 2000/- the freight cost will be beared by the customer and if the total order value is more than 2000/- then the company will bear the freight cost. We are using two condition types for freight calculation for this scenario. What can be the way to get this?
    useful suggestions will be awarded points.
    Sunanda.p

    Hi
    SUNANDA.P
    U can achieve this by using scale in yr freight condition. Select yr freight condition and go to Tcode V/06 there u will find SCALE TAB -
    scale basis,  u select " B ". Now maintain condition scale value 2001 then freight rate will be e.g. 500 rs.
    In VK11u can go to scale by pressing F2.
    Try and this will help you
    Thx.
    Dwarkesh

Maybe you are looking for