Results 1 to 2 of 2

Thread: Fetch last record from duplicate values

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Hyd - INDIA
    Posts
    57

    Unhappy Fetch last record from duplicate values

    Hi, i have a sql table where there is no primary key defined on the key field (123 below) as it contains duplicates. From the below sample data if i need to know which is the last updated record what should i do ? In Foxpro the below is achieved using the scan() function.. pls help me with the query in VB as i have been struggling since long to get this up working.


    Num Delvd Date Time Delay reason Entry_date Time

    123 2002-09-03 0600 CUSTOM HELD NULL 2002-09-03 1209
    123 2002-09-03 1600 CUSTOM HELD NULL 2002-09-03 1640
    123 2002-09-04 1700 CUSTOM HELD NULL 2002-09-04 1734
    123 2002-09-08 0900 CUSTOM HELD NULL 2002-09-08 1014
    123 2002-09-12 1600 CUSTOM HELD NULL 2002-09-12 1635
    123 2002-10-08 1500 NULL SIGN 2002-10-09 1505

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951
    How about something like...

    SELECT * FROM <TABLE> ORDER BY <FIELDS>

    SET RS = DB.OPENRECORDSET...

    IF RS.RECORDCOUTN > 0 THEN
    RS.MOVELAST
    ENDIF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width