Select one record for each member of the group

Hi,
am having a table where in i will be having data for so many group members. i need to fetch data for a particular group members whose number of rows of data may be more in numbers (but i want only one row of data for each member of the group)
here is the query for fetching all rows of data
select RI.RESOURCE_NAME,TR.MSISDN,TR.ADDRESS1_GOOGLE, TR.MSG_DATE_INFO, FROM TRACKING_REPORT TR, RESOURCE_INFO RI
WHERE TR.MSISDN IN (SELECT MSISDN FROM RESOURCE_INFO WHERE GROUP_ID ='1' AND COM_ID=2 ) AND RI.MSISDN=TR.MSISDN
order by MSG_DATE_INFOoutput of this query is...
>
ddd     12345          13-Mar-10 19:43:03
eee     54321     Tamil Nadu, India      13-Mar-10 19:39:48
ddd     12345          13-Mar-10 19:32:58
eee     54321     Tamil Nadu, India      13-Mar-10 19:30:07
ddd     12345          13-Mar-10 19:23:08
eee     54321     Tamil Nadu, India      13-Mar-10 19:20:14
fff     98765          13-Mar-10 19:19:22
ddd     12345          13-Mar-10 19:13:01
eee     54321     Tamil Nadu, India      13-Mar-10 19:09:50
ddd     12345          13-Mar-10 19:02:56
eee     54321     tn,ind      13-Mar-10 18:59:49
ddd     12345          13-Mar-10 18:53:08
eee     54321     tn,ind      13-Mar-10 18:49:50
ddd     12345          13-Mar-10 18:42:56
eee     54321     tn,ind      13-Mar-10 18:39:50
ddd     12345          13-Mar-10 18:33:00
eee     54321     tn,ind      13-Mar-10 18:29:50
ddd     12345          13-Mar-10 18:22:54
eee     54321     tn,ind      13-Mar-10 18:19:50
ddd     12345          13-Mar-10 18:12:56
eee     54321     tn,ind      13-Mar-10 18:09:50
ddd     12345          13-Mar-10 18:02:54
eee     54321     tn,ind      13-Mar-10 18:00:02
fff     98765     Tamil Nadu, India      13-Mar-10 17:59:26
fff     98765     Tamil Nadu, India      13-Mar-10 17:54:26
ddd     12345          13-Mar-10 17:52:56
eee     54321     tn,ind      13-Mar-10 17:49:50
fff     98765     Tamil Nadu, India      13-Mar-10 17:49:25
fff     98765     Tamil Nadu, India      13-Mar-10 17:44:26
ddd     12345          13-Mar-10 17:42:56
>
from this output i want only one latest record for each member(ddd,eee,fff). i.e
>
ddd     12345          13-Mar-10 19:43:03
eee     54321     Tamil Nadu, India      13-Mar-10 19:39:48
fff     98765          13-Mar-10 19:19:22
>
how to modify the query to achieve this...?

Hi,
This is not giving the result which i want...
table is
CREATE TABLE TRACKING_REPORT
  ID               NUMBER,
  MSISDN           NUMBER(12)                   NOT NULL,
  X                NUMBER(15,8)                 NOT NULL,
  Y                NUMBER(15,8)                 NOT NULL,
  TIME_STAMP       DATE,
  MSG_DATE_INFO    DATE                         DEFAULT sysdate,
  ADDRESS1_GOOGLE  VARCHAR2(400 BYTE),
  ADDRESS2_GOOGLE  VARCHAR2(400 BYTE),
  ADDRESS_MLINFO   VARCHAR2(400 BYTE),
  REQ_ID           VARCHAR2(30 BYTE)
CREATE TABLE RESOURCE_INFO
  RESOURCE_ID    NUMBER,
  MSISDN         NUMBER,
  RESOURCE_NAME  VARCHAR2(25 BYTE),
  ADDRESS        VARCHAR2(100 BYTE),
  COM_ID         VARCHAR2(20 BYTE),
  ADMIN_ID       NUMBER,
  TIME_STAMP     DATE                           DEFAULT SYSDATE,
  GROUP_ID       NUMBER
)

Similar Messages

  • When we drilldown at document level it displays one record for each cube

    Dear Experts .
    The users want to see the report by status for the order detail report at document level it displays one record for each cube .
    They want to see the single line for the order quantity , Amount, Billing quantity delivery and amount along with the Sales order number , billing document number billing date , delvert date ..et in signgle line. ( Sale order DeliveryBilling)
    When we are doing on Multiprovider recording displaying from each cube.
    We have tried with Constant selections and it is not giving the required results m since these want to see by status. Due to huge data performance reasons we re unable to use it .
    Please provide your valuable inputs.
    Thanks,
    Mahesh.

    Mahesh,
    If you want to get detail data with respect to Sales order - delivery - Billing, on top of Multiprovider you can come up with Constant selection.
    But I am not clear that why constant selection is not working properly, can I have some light on that.
    Probably, you are struggling with multiple records .
    I suggest you to go with end routine and map all fields to one IC and do reporting on that single IC, then your requirement will fulfill.
    But here we need to take care of performance issues and process chain scheduling wile loading deltas.
    If Multiprovider is not working properly , then try with Infoset(If you have more than 2 ICs it not possible).
    Regards,
    rvc

  • MS word It prints one file for each section of the document

    With MS word (2004 and 2008)It prints one file for each section of the document.
    somebody can help me with that????

    Please post Office related questions on Microsoft's own forums for their Mac products:
    http://www.officeformac.com/productforums

  • Selecting many records for each material...

    Hi all,
    I have an internal table that contains a list of materials. I want to loop over that list and retrieve a group of purchase reqs from EBAN for each material...appending each group of rews to my req table for each pass over the material list. Sample code;
    LOOP AT GT_MATERIALS INTO WA_MATERIALS.
    SELECT MENGE LFDAT
        INTO CORRESPONDING FIELDS OF TABLE GT_EBAN_FIELDS
        FROM EBAN
        WHERE MATNR EQ WA_MATERIALS-MATNR.      
        ???DO I DO AN APPEND OF SOME KIND HERE???
    ENDLOOP.
    Regards,
    Mat

    Hi Mathew,
    From performance point of view, the SELECT QUERY should not be under a loop. So you can do the following :
    <b>SORT GT_MATERIALS.
    IF not gt_materials is initial.</b>
    SELECT MENGE LFDAT
    INTO CORRESPONDING FIELDS OF TABLE GT_EBAN_FIELDS
    FROM EBAN
    <b>FOR ALL ENTRIES IN GT_MATERIALS</b>
    WHERE MATNR EQ GT_MATERIALS-MATNR.
    <b>ENDIF.</b>
    Also if the structure of table GT_EBAN_FIELDS has only two fields MENGE, LFDAT then please remove INTO CORRESPONDING FIELDS, instead use INTO TABLE GT_EBAN_FIELDS. This is becz INTO CORRESPONDING FIELDS would affect the performance.
    Best regards,
    Prashant

  • Select one record for the first matching condition only in four where condi

    I need your suggestion to write one tricky SQL query to select only one record from database on the following condition.I explained simple table structure below.I have a table temp with four columns a,b,c,d in it.
    I have to select column d from this temp table based on the following four conditions.If it matches any condition, It should skip other conditions, that's the tricky thing.
    Conditions order is like shown below.
    1) a='argument1' and b='argument2' and c='argument3'(If it matches this condition, it should stop selecting below 3 conditions)
    2) a='argument1' and b='argument2' and c='none'(If it matches this condition, it should stop selecting below 2 conditions)
    3) a='argument1' and b='none' and c='argument3'(If it matches this condition, it should stop selecting below condition)
    4) a='argument1' and b='none' and c='none'(this is last condition)
    If I use OR operator , it matches all of those other conditions too.I never wrote query like this before.
    I greatly appreciate if somebody sheds light on me to start writing this query with a simple suggestion.
    Thanks,
    GD

    This forum might help you out, as they are experienced SQL developers, however, this forum is primarily for queries about the tool, SQL Developer. I recommend you post this on the SQL & PL/SQL forum where they focus on these queries:
    PL/SQL
    Sue

  • Howdo I obtain a column with the calculated age for each member in the membershiplist? memberlist

    The list contains 250 rows of names and their DoB (Date of Birth) = colum A and B.
    The 3r colum should feature the automatically calculated AGE in years only = colum C from TODAY
    It is a **** of a job to input the  DATEDIFF formula for each cell (of colum C).
    Can this be simplified?
    Pleas help to find the right solution for Numbers '09 (version 2.1)
    Thanks

    Hi Lepe,
    Assuming the first row of your table is used for labels (Name, DOB, Age, etc) and the data starts in row 2...
    In C2, enter: =DATEDIF(B2,TODAY(),"Y")
    Hover the mouse pointer over the Fill Handle (small circle) at the bottom right of the selected cell (C2).
    When the mouse pointed turns to a black cross ( + ), click and drag the control down to fill the formula into the rest of the cells in the column.
    For a 250 row table, there are other, more efficient ways of filling the formula down the column. These are described in the User Guide section referenced in Jerry's post.
    Regards,
    Barry

  • How do i query a sun one server for a member of a  group

    Hi Folks
    I would like to know if any one know how to query a sun one directory server to list all members of the group.
    currenty i have this
    LDAP://SERVERNAME.test.com:5221/ou=people,dc=testrelsec,dc=com>;(&(objectclass = person)& adsPath;subTree"
    this query gives me all users in the directory ,
    Now I have created a static group called GROUPONE using sunone console GUI and made 2 people member of that group
    I need the ldap query which can list the members of GROUPONE
    thanks
    g4hbk
    thanks in advance
    g4hbk

    https://www.redhat.com/archives/fedora-directory-users/2005-September/msg00010.html
    Useful script to extract LDAP based user posixGroup memberships information
    ===
    Assuming you are using posixGroup objectclass and memberUid attribute to
    store your membership information, you may find my shell script useful
    and handy.
    It works on Solaris LDAP Client with "ldapaddent" and "ldaplist"
    commands, and works against FDS, SUN DS or OpenLDAP.
    ===
    Gary

  • Ungroup a group and keep the scriptlabel for each item of the group

    Hi
    does someone know how to ungroup a group of rectangles with a certain label (example groupA) an give each rectangle a own label (the same text groupA)
    I can find the group and ungroup it but I can't label the rectangles...
    var oPageItems = app.activeDocument.allPageItems;
    for (var j = oPageItems.length-1;  j >= 0; j--) {if (oPageItems[j].label==("groupA")) {oPageItems[j].ungroup();)
    Please help

    Hi,
    before
    oPageItems[j].ungroup();
    go into the loop and set proper label to each item inside group:
    for (var k; k < oPageItems[j].length; k++)
    oPageItems[j][k].label = "groupA";
    assuming your oPageItems[j] is a group indeed.
    hope...

  • Why can i only select one LUN for repository creation from the list of LUNs

    1) have successfully created a server pool with heartbeat/cluster lun of 15GB storage
    2) Now trying to create repositories for VMs - Unable to select more then 1LUN per repository - we have a requirement of over 14TB and have 1TB per LUN does this mean we will require 14 repositories??? Please help
    Thanks in advance

    right....It seems as though we will have to have 1TB LUNs per Repository, one question that comes to mind is that is it possible for a single VM to use more then one repository any ideas... ??
    so for example if a VM needs to utilise remaining free space from a LUN is this possible or if a VM needs a bigger partition then 1TB can we use 2 x repositories to build this partition?? as we have max 1TB LUNs from storage.
    Or will we have to request a amendment to the size of LUNs to increase to 2TB from storage? 2TB being max supported to a repository

  • SQL help: return number of records for each day of last month.

    Hi: I have records in the database with a field in the table which contains the Unix epoch time for each record. Letz say the Table name is ED and the field utime contains the Unix epoch time.
    Is there a way to get a count of number of records for each day of the last one month? Essentially I want a query which returns a list of count (number of records for each day) with the utime field containing the Unix epoch time. If a particular day does not have any records I want the query to return 0 for that day. I have no clue where to start. Would I need another table which has the list of days?
    Thanks
    Ray

    Peter: thanks. That helps but not completely.
    When I run the query to include only records for July using a statement such as following
    ============
    SELECT /*+ FIRST_ROWS */ COUNT(ED.UTIMESTAMP), TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD') AS DATA
    FROM EVENT_DATA ED
    WHERE AGENT_ID = 160
    AND (TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY')+(ED.UTIMESTAMP/86400)), 'MM/YYYY') = TO_CHAR(SYSDATE-15, 'MM/YYYY'))
    GROUP BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD')
    ORDER BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD');
    =============
    I get the following
    COUNT(ED.UTIMESTAMP) DATA
    1 07/20
    1 07/21
    1 07/24
    2 07/25
    2 07/27
    2 07/28
    2 07/29
    1 07/30
    2 07/31
    Some dates donot have any records and so no output. Is there a way to show the missing dates with a COUNT value = 0?
    Thanks
    Ray

  • Join two tables, return max 1 record for each left

    I want to join tables A and B, but I only want to return a maximum of one record for each record on the left.  For example
    Table A
    Bob,1
    John,2
    Jill,3
    Table B
    1,MountainTime
    1,MountainTime
    2,CentralTime
    3,PacificTime
    Result
    Bob,MountainTime
    John,CentralTime
    Jill,PacificTime

    Hi Andrew,
    Create a report by joining two tables and insert a group on code(1) and place your fields on goup footer.
    This will give only one record.
    Thanks,
    Sastry

  • Using IF in a for each loop which is grouped by two fields

    Hi ,
    My requirement is to filter the Payment records ,based on the parameter input date and also group by based on two of the Fields and calculate the sum of the payment Amounts.
    I have created a for each loop with the group by first on one field and then the other field.
    My question is where should I put my IF condition based on parameter dates ?
    If condition would be if Created = Date Parameter .CAn anybody help where I should insert the IF condition in the below code.
    Ex:
    <?for-each-group:Payments;./Created?>
    Display Date : Created
    <?for-each-group:current-group();./CreatedByName?>
    Table      :      CreatedByName     count of Payments           Sum of Amount
    <?end for-each-group?>
    <?end for-each-group?>
    thanks.

    Hi ,
    I got the result by putting the filter in [ ]
    Ex:
    <?for-each-group:Payments[PaymentStatus != 'New';./CreatedDate?>
    here I am filtering the records based on [Payment Status != New] and then group by Created Date .
    Similarly I can new another condition as well in the same statement
    <?for-each-group:Payments[PaymentStatus != 'New'][PaymentMethod != 'Cash'];./CreatedDate?>
    Regards.

  • Profile Manager Settings for Group does not display for individual members of the group

    Hi there,
    Can anyone confirm whether I am going mad or not, I and new to Mac Server and have set up Profile Manager on OSX Mavericks from scratch and have been using it successfully to deploy enterprise iPads. I have just gone to edit the profile as we wish to increase the timeout time to locking and have been greeted with something strange.
    We have all users in a Group which has settings applied for timeout, pass code change etc. however if I go to an individual account who is part of that group then it isn't showing any settings for that user and it would appear I need to set them again. Similarly if I go to a device belonging to a member of the group then its not showing any settings for that device.
    I would have assumed that if you set restrictions for a group then when you view the restrictions for a member of the group then it would be the same however it appears that you can have a separate payload for a group. Is this the case?
    I am grateful for any advice people can give me.
    Thanks again.
    Rob

    I would have assumed that if you set restrictions for a group then when you view the restrictions for a member of the group then it would be the same
    That was never the way it worked in older versions of 10.3, 10.4, 10.5, 10.6 Server.
    The restrictions for a Group were shown for a Group. The restrictions for a User (alone) were shown for that User.
    And the advantage is that if you see something wrong for a single user, you might be tempted to fix it there, in that user, and when you had changed six of them, you might remember that you meant that to be a group setting after all.
    And the software to implement them separately is simpler, but YOU have to test it to find out the end results of compositing Group and User settings.

  • My family shares one apple id. Is there any way to make an apple id for each member of my family and have it all connected to the same credit card and have the same previous downloads open to download by signing in to each members personal apple id?

    My family shares one apple id. Is there any way to make an apple id for each member of my family and have it all connected to the same credit card and have the same previous downloads open to download by signing in to each members personal apple id?

    Hi cindy,
    If you all have individual Apple IDs, then you would be able to dowload music from a shared iTunes library on a computer, but you would not be able to sign on each individual ID on an iOS device in order to download music purchased under the original Apple ID without a 90-day waiting period between sign-ons.
    Here's what I mean:
    If you were to sign on a new Apple ID on, say, an iPhone, and then were to purchase and download some music from iTunes, then you would have to wait 90 days before you could sign on the old Apple ID to that iPhone in order to download previously purchased material (and vice versa).
    However, if all of the music purchased by that origjnal Apple ID is in an iTunes library on a shared computer, then you can hook up the device and selectively sync any music in that library to the device. You can also sign on any of the Apple IDs to that shared iTunes library and purchase music to be added to the library.
    You would need to authorize the computer for each of the new Apple IDs.
    Each of the Apple IDs would also be able to download that music purchased either by syncing to the iTunes library on the computer or by downloading it OTA on the device.
    So, each Apple ID can download music, movies, etc. purchased with that Apple ID OTA to the device. Also each Apple ID can sync any music, movies, etc. that are in the iTunes library on the computer regardless of who purchased them.
    The only other thing you would need to remember is that if an App needed to be updated, then the original Apple ID that was used to purchase that App would come up, and the password that goes with that Apple ID would be required to do the update.
    Hope that helps,
    GB

  • I need a query that selects the amount of records for each day in a table.

    I need a query that selects the amount of records for each
    day in a table.
    Eg the result would be:
    date 1 14
    date 2 3
    etc
    Any ideas?

    sorted:
    SELECT count([commentID]),convert(varchar, dateAdded, 112)
    FROM COMMENTSgroup by convert(varchar, dateAdded,
    112)

Maybe you are looking for

  • Take a look at what Aperture can do!

    I`d like to have the ability to view pictures like the way it`s possible in Aperture: - Realtime loop even with RAWs - compare images side by side (Aperture puts as many images as you want side by side and btw. in a much more elegant and faster way t

  • Why are the podcast search results not showing in iTunes?

    I've been trying to search for some podcasts, and my results don't show up in iTunes. I've tried on my Mountain Lion MBP, and on my Windows 8 Laptop. Same effect happens. Is there something going on with search results in iTunes?

  • Fund management Table Name

    Hi SAP Team, My clint asked me to downlode data from Production System, He want Combination data like Cost Center + Profit Center + Fund Center data, i am taking data from Table CSKS, with Cost Center + Profit Center... Please suggest me how can i do

  • RDC and Crystal 11.5 license for deployment

    Post Author: Matt_au CA Forum: Deployment Hi, Advised my boss that i would be able to embed the designer into a vs2005 win form and use the wizard to create reports. runs fine on the local dev machine. it displays a message "This system does not have

  • JDev3.0 - Dynamic update of gridcontrol --Error

    Hi, I am trying to update a infobus gridcontrol dynamically using this code. DbAccess dba = sessionInfo1.getDbAccess(); RowsetAccess rsi = null; String stmnt = "select br_code as \"code\",br_desc as \"desc\" from brand"; try { rsi = (RowsetAccess) db