Fetch last match data..

table
id carno houseno entrytime                            exit time
1  11       333        3/4/2014 3:15:18 PM         3/4/2014 3:25:18 PM
2  11       333        3/4/2014 3:35:18 PM         3/4/2014 3:45:18 PM
3 11       333        3/4/2014 3:55:18 PM         3/4/2014 4:25:18 PM
4  14       33        3/4/2014 4:35:18 PM         3/4/2014 5:25:18 PM
5   15      544      3/4/2014 6:35:18 PM         3/4/2014 7:25:18 PM
6 11       333        4/4/2014 3:55:18 PM         null
7 15      544        6/4/2014 3:55:18 PM         6/4/2014 4:25:18 PM
this is my table structure.............
so my query is i want to search row which use where clause to match carno and houseno.....in my table so many place carno and houseno are same but only timings are different ..i want to select the last entry which matchs...
example i give input houseno-333 and carno-11 then i want to serch last entry for this same houseno and carno...that means id-6 will be fetch.......how to achieve this.....i m able to fetch last record with where clause like house no and carno condition.....then
i want to check is exit time in null in dis row or having some value...
fynl summary i want to retrive last row based on where clause after retrivinbg i want to check value of exit column....
is it blank or some value in exit time..

there are so many issue arise when i test with dummy values..
 some chnges.....
id carno houseno entrytime                            exit time
1  11       333        3/4/2014 3:15:18 PM         null
2  11       333                       null                     3/4/2014 3:45:18 PM
3 11       333        3/4/2014 3:55:18 PM        null
4  14       33       null                                     3/4/2014 5:25:18 PM
5   15      544      3/4/2014 6:35:18 PM         null
6 11       333        4/4/2014 3:55:18 PM         null
7 15      544        6/4/2014 3:55:18 PM         null
now i have to find if there is two  simulatneously entry  happening in a sequence means without exit
 between  two entry of same carno and house no..   thn i need to beep alarm.....if entry tym is store then it should exit first for reenter again....if somehave two duplicate id of card no and house no..then we need to find duplicate of id....this
is rfid tag which is used for enter in a society,,,,entry gate will open after  identify this tag
example/////// id-5 carno-15 enter at  3/4/2014 6:35:18 PM  means last entry inserted...after tht no exit
happen for this carno and houseno.......at 7 id it will try again to enter..but it doesnot have exit so we need to restrict this.......

Similar Messages

  • How to fetch last changed date for Header in me22n?

    Hi Experts,
    I need to create a report for PO, where I have created one screen tab in Header level(customer data), therefore I need to fetch last changed date for header , I must mention that I do not want last changed date for item level, only for header last changed date is required.
    Kindly assist me on this.
    Thanx
    Shireen

    Read table CDHDR (object "EINKBELEG") and CDPOS (look for table name EKKO), keep the last CDHDR record with "EKKO" data actually changed.
    Regards,
    Raymond

  • Fetching un-matching data

    Hi,
    From the below code snippet, I want to fetch the non-matching data from table "T1".
    DROP TABLE T1;
    DROP TABLE T2;
    CREATE TABLE T1
    F1 INTEGER,
    F2 VARCHAR2(100 BYTE),
    F3 CHAR(1)
    CREATE TABLE T2
    FLD1 INTEGER,
    FLD2 VARCHAR2(100 BYTE)
    begin
         insert into t1
         values(1, 'A1', 'F');
         insert into t1
         values(1, 'A2', 'F');
         insert into t1
         values(1, 'A3', 'T');
         insert into t1
         values(2, 'A1', 'T');
         insert into t1
         values(3, 'A1', 'F');
         insert into t2
         values(1, 'T1');
         insert into t2
         values(2, 'T2');
    end;
    select * from t1;
    select * from t2;
    Query A)
    select t1.*, nvl(t2.fld1, -1), nvl(t2.fld2, 'EMPTY')
    from t1, t2
    where t1.f1 = t2.fld1 (+);
    Query B)
    select t1.*, t2.*
    from t1, t2
    where t1.f3 = 'T' and t1.f1 = t2.fld1;
    Upto this, it is fine, now, I want to fetch the resuts of "Query A" using something like given below,
    without applying outer join, this would look silly, unfortunately cannot avoid it.
    I am just trying to fetch the unmatching data from T1, when F3 field is
    when "F3 = 'T'" then matching data using "t1.f1 = t2.fld1" should be fetched, otherwise
    no join condition be applied.
    I just tried using the below SQL, it gives "ORA-00905: missing keyword" error, I understand it is not correct.
    select t1.*, t2.*
    from t1, t2
    where case when t1.f3 = 'T' then t1.f1 = t2.fld1 else NULL end;
    I cannot use scalar subqueries for this requirement, as it is quite expensive, please give me other alternatives
    for this, that should be helpful to me, thank you.

    I'm kind of confused about your requirements.
    Do you want to return ALL rows from T1 and only the values from T2 where T1.F3 = 'T'?
    Something like this maybe?
    SELECT  T1.*
                    CASE
                            WHEN T1.F3 = 'T'
                            THEN NVL(T2.FLD1,-1)
                    END
            )       AS FLD1
                    CASE
                            WHEN T1.F3 = 'T'
                            THEN NVL(T2.FLD2,'EMPTY')
                    END
            )       AS FLD2
    FROM    T1
    ,       T2
    WHERE   T1.F1 = T2.FLD1(+)Sample Results:
    SQL > /
    F1 F2  F FLD1 FLD2
      1 A3  T    1 T1
      1 A2  F
      1 A1  F
      2 A1  T    2 T2
      3 A1  FCan you please post the expected output as well?
    We all appreciate that you posted sample data and the DDL to go with it can you post the following too?
    1. Oracle version (e.g. 10.2.0.4)
    2. Sample data, and expected output in \ tags (see FAQ for more information).
    Edited by: Centinul on Aug 14, 2009 6:46 AM
    Added query...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • PLEASE HELP ME TO FETCH LAST 3Weeks data in SQL

    I have to display 3 weeks data when the user selects one week.
    In the front end i have start date and end date , after selecting the start and end date i have drop down list which will display the weeks . By passing weekid i need to fetch data for last 3 weeks, is this possible by passing only the week id. and what
    if the user selects the last year as start date and current date as end date....
    for example
    if the user selects week -38
    it should display data for week 38,37 and 36 . this is working if by decrementing the week by 1.
    what if the user selects week 1, it should select the last 2 weeks of previous year as well. how will i do this by using week id...please help 

    Please try following code in which you can change @increament value as you wish.
    --sample DDL & DML
    DECLARE @Table TABLE ( WeekId INT PRIMARY KEY );
    INSERT @Table
    VALUES ( 1 ), ( 2 ),( 3 ), ( 4 ),( 5 ),( 6 ), ( 7 ),( 8 );
    --input parameters
    DECLARE @WeekId INT = 1 ;
    DECLARE @Increament INT = 2 ;
    DECLARE @Mn INT ;
    SELECT
    @Mn = CASE
    WHEN ( SELECT MAX(T2.WeekId) FROM @Table AS T2 WHERE T2.WeekId = T1.WeekId - @Increament ) IS NULL
    THEN ( SELECT MAX(WeekId) FROM @Table ) - @Increament + T1.WeekId
    ELSE ( SELECT MAX(T2.WeekId) FROM @Table AS T2 WHERE T2.WeekId = T1.WeekId - @Increament ) END
    FROM
    @Table AS T1
    WHERE
    T1.WeekId = @WeekId ;
    IF @WeekId < @Mn
    SELECT *
    FROM @Table
    WHERE WeekId <= @WeekId OR WeekId >= @Mn ;
    ELSE
    SELECT *
    FROM @Table
    WHERE WeekId BETWEEN @Mn AND @WeekId ;
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • How to fetch year till date value for earning for current ,last and year

    hi,
    how to fetch year till date value for earning for current ,last and year before that from payroll result
    plz reply soon,
    pratyush

    Dear Pratyush,
    Pick this from CRT.
    Use LDB PNPCE & Fire event GET PAYROLL &
    then you can pick from CRT.
    Hope this helps.
    Kindly reward in case useful.
    Regards & Thanks,
    Darshan Mulmule

  • First Generation Ipod Shuffle: Play count and Last Played date

    I have a 1st Gen Ipod shuffle that works great in all other respects but it doesn't track the number of "plays" or the "last play" dates. Which means I can't use the "Smart Playlists" Itunes feature to be sure that the music on it stay fresh, non-repetitive. Another problem is if I listen to a podcast on the Ipod Shuffle then in Itunes the podcast appears as though it has never played before. This gets confusing as I listen to a number of podcasts.
    I have tried resetting and restoring the Ipod shuffle. Is there anything I can do to it to make it track the number of plays or last played dates?

    All my tracks should be MP3s or AAC.  I ripped them myselfs with iTunes.  I may have bought some songs directly off of record labels or some other online music store, but I own my music legally whether I bought it on CD or got given it by magazines or record labels.
    I went to the gym today.  I set the shuffle to random.  Some songs were synched back to iTunes but they weren't the songs I listened to, at least not all of them.  Some of them may have been the songs I listened to last workout, at least one or two of the songs updated I did listen to today.
    I listened to some other songs last night on my main Mac so it is easy to determine which songs iTunes updated this morning.
    I haven't had much time to play with Match.  It is still updating and uploading, it has 6000 songs to go.  That means in a half month of trying it has managed to find and/or upload a little over 1000 songs actually close to 2000 now.  It is something, but it isn't the service I was sold.  All my songs and playlists were supposed to be available in the cloud.  That hasn't happened and in the case of my smart playlists will never happen. 
    I'll read you link, but I wrote a blog posting how I was disappointed with the service so far.
    Thanks!

  • IPod Shuffle 2 no longer updating playlist play count and last played date

    I use my shuffle 2 in the gym.  When I'm done working out I sync and the most recently played songs are rotated off using a smart play list.  This is no longer working.  I reset the shuffle 2, I've forced sync and auto filled many times.  My latest workout it still lists all the songs I just listened to in the order I listened to them and has their last played date as many months ago.
    This seems to be affecting my other iPod too, but it is tougher to diagnose.  I signed up to iTunes Match and after several days that is still running but I noticed this problem long before iTunes Match became available in Canada.  Both my iPod Shuffle and iTunes are up to date but my music is on an older but upgraded Mac.  It has a G4 so no Lion upgrade, I just checked it is 10.5.8

    All my tracks should be MP3s or AAC.  I ripped them myselfs with iTunes.  I may have bought some songs directly off of record labels or some other online music store, but I own my music legally whether I bought it on CD or got given it by magazines or record labels.
    I went to the gym today.  I set the shuffle to random.  Some songs were synched back to iTunes but they weren't the songs I listened to, at least not all of them.  Some of them may have been the songs I listened to last workout, at least one or two of the songs updated I did listen to today.
    I listened to some other songs last night on my main Mac so it is easy to determine which songs iTunes updated this morning.
    I haven't had much time to play with Match.  It is still updating and uploading, it has 6000 songs to go.  That means in a half month of trying it has managed to find and/or upload a little over 1000 songs actually close to 2000 now.  It is something, but it isn't the service I was sold.  All my songs and playlists were supposed to be available in the cloud.  That hasn't happened and in the case of my smart playlists will never happen. 
    I'll read you link, but I wrote a blog posting how I was disappointed with the service so far.
    Thanks!

  • How to display document last modfied date time in core result web part?

    Hi,
    We have a requirment in the sharepoint application where we need to display last modified date&time of document in core result web part.
    To support this we have specify the property <Column Name="Write"/> in custom XSL.
    But it displays only the modified date.Is there is way to display modified date and time as well?
    D.Ganesh

    If you want to modify the
    XML can do i tin the
    template "DisplayTemplate":
    An example:
    Replace
    <xsl:value-of select="write" />
    by
    <xsl:value-of select="ddwrt:FormatDate($write, 1033, 2)"/>
    But I think the managed property"Write"
    is returned only as
    Date without
    Time. By
    this time will
    always 00:00.
    To see the resulting XML
    can replace
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
    <xmp><xsl:copy-of select="*"/></xmp>
    </xsl:template>
    </xsl:stylesheet>
    Where you see the format
    of "write"
    http://msdn.microsoft.com/en-us/library/ms546985(v=office.14).aspx
    Miguel de Hortaleza

  • Last Import Date Report

    Hiya. I have several tables that are appended to (some daily, some weekly) via data workshop (HTML-DB 1.6.1/10g). The tables contain standard data (computer generated alerts, security scan results, &c.) and do not implement TS (because, frankly, I can't figure it out yet). I'd like to create a small report on the main page of my app that lists specified tables (T1, T2, T3) and reports-back the last time they were appended to so I can quickly see if they are up-to-date (e.g. "T1, 05/25/2005 13:35).
    Would someone mind pointing me in the right direction? Thanks!

    My suggestion is to use the vendors table (PO_VENDORS) and the checks table (AP_CHECKS_ALL). Bring in vendor id, vendor name, and check date. Use a Last_Value function on check date to return the last check date for the vendor. See if that might work out. Or if having trouble with that, define the join in the business area between the vendors table and the checks table to be an outer join on detail, that will return master rows with no detail and master rows with matching detail. Take out check date from the format and add sum of amount to the format. Then edit for a check date (say >= '01-Jan-2008') that if you don't have any activity for after that date, then you want to get rid of those vendors. Run the workbook and any vendor with no activity will show as a NULL value for sum of check amounts (so have to add Amount(SUM) from the checks table to the workbook item list). Vendors with activity after that check date will show a numeric amount (might be 0 if in and out). You can then add a condition to filter for amount IS NULL and get the list of vendors that you want to look at disabling. Worked like a charm when I tested that here.
    John Dickey
    Edited by: John Dickey, McCarthy on Nov 3, 2009 12:13 PM
    Edited by: John Dickey, McCarthy on Nov 3, 2009 12:19 PM
    Edited by: John Dickey, McCarthy on Nov 3, 2009 12:22 PM

  • Last Transaction Date Report

    hi
    I'm trying to run a report in order to audit our database of suppliers (over 1000) (supplier records managed in symmetry)
    I need to see against every supplier the last date that we paid them so that I can identify the ones not used in the last 2yrs and disable them.
    the closest report I'm getting is one that shows every payment date for every supplier and is so large that I'm running out of space in excel when exporting the report.
    Any advice on what items to select and parameters to set in order to get this report would be much appreciated!!!!!

    My suggestion is to use the vendors table (PO_VENDORS) and the checks table (AP_CHECKS_ALL). Bring in vendor id, vendor name, and check date. Use a Last_Value function on check date to return the last check date for the vendor. See if that might work out. Or if having trouble with that, define the join in the business area between the vendors table and the checks table to be an outer join on detail, that will return master rows with no detail and master rows with matching detail. Take out check date from the format and add sum of amount to the format. Then edit for a check date (say >= '01-Jan-2008') that if you don't have any activity for after that date, then you want to get rid of those vendors. Run the workbook and any vendor with no activity will show as a NULL value for sum of check amounts (so have to add Amount(SUM) from the checks table to the workbook item list). Vendors with activity after that check date will show a numeric amount (might be 0 if in and out). You can then add a condition to filter for amount IS NULL and get the list of vendors that you want to look at disabling. Worked like a charm when I tested that here.
    John Dickey
    Edited by: John Dickey, McCarthy on Nov 3, 2009 12:13 PM
    Edited by: John Dickey, McCarthy on Nov 3, 2009 12:19 PM
    Edited by: John Dickey, McCarthy on Nov 3, 2009 12:22 PM

  • Finder doesn't show correct "last modified" dates

    For the longest time, the Tiger Finder has not always shown the correct "last modified" dates for files. Is there any fix or workaround for this?
    Frequently, if I'm working in a folder with a bunch of files in it, and working in each individual file, and viewing the folder in list view, the modified date for each file will not update as I work on the file. Even if I close and reopen the folder, it won't update. Sometimes when I click on an individual file, the date will update. Other times not. If I use "Get Info" to look at the file, then I see its true last modified date.
    I believe this used to be a problem in prior OS's too, and someone recommended a little contextual menu plug-in called "Nudge" to me. I went looking for that, found it, and installed it, but it doesn't do what I want. Now if I "nudge" a file, the Finder instantly marks it as modified right that second. That's not what I want. I need to know the last time the file was TRULY last modified, and I need it to show up immediately.
    I work with a large quantity of files and part of the management scheme is figuring out, at a glance, when each file was last modified, so I can keep track of their development.

    Hi folks,
    This issue has been driving me crazy, and I've been searching everywhere for a solution... today I am happy to report that I found one!
    Limit Point Software has just released a great utility for dealing with this issue where folders have their "Date Modified" altered after you just opened the folder.
    It is called "SyncFF" and you can download at:
    http://www.limit-point.com/Utilities.html
    Here is the product description:
    SyncFF is a drop utility for setting the modification and creation date of folders to the latest modification date of their contained files. This way the modification date of the folder matches the modification date of the "oldest" file it contains. The process is recursive, which implies all subfolders are processed too. Universal Binary, Mac OS X 10.4 and above.
    It works wonderfully, and it is so nice to have the proper modification dates on my folders and projects again.
    I should also say that the developer is very helpful and responsive to feedback.
    Zed

  • Robohelp 10 - Inserting a Last modified date in a topic - how can it be achieved?

    Hi there,
    this is my first post, so apologies if I am in the wrong place...
    I would like to insert a "last modified" date in my topics, but can't figure out how to do this! The Date field inserts today's date whenever the topic is opened, and so doesn't reflect the timeframes of changes accurately.
    I'd appreciate any help on this.
    Thank you
    Caroline

    Hi there
    When you insert the field, look at the options.
    See that option for auto updating? Try clearing it and the field shouldn't auto-populate.
    But note that now the onus is on the help author to ensure they perform the update if they want the date to finally match the current date.
    Cheers... Rick

  • Get last modified date and time of sharepoint site through Search

    Hi All,
    I am trying to get the last updated date and time of a sharepoint site using KeywordQuery.
    For this I updated an existing list item, added a new item in a site and crawled the content. Then I used "ContentClass:STS_Site" as query in C# code to fetch the search results. I am able to get most of the properties I require for that
    site. However "LastModifiedTime" does not return the correct value. It returns an older value.
    How can I get the last updated date of a sharepoint site using search ?
    Regards,
    Vipul Kelkar

    No, unless you can use an FTP client.

  • Fetch last record from database table

    hi,
    how to fetch last record from database table.
    plz reply earliest.
    Regards,
    Jyotsna
    Moderator message - Please search before asking - post locked
    Edited by: Rob Burbank on Dec 11, 2009 9:44 AM

    abhi,
    just imagine the table to be BSEG or FAGLFLEXA... then what would be performance of the code ?
    any ways,
    jyotsna, first check if you have a pattern to follow like if the primary key field have a increasing number range or it would be great if you find a date field which stores the inserted date or some thing..
    you can select max or that field or order by descending using select single.
    or get all data.. sort in descending order.(again you need some criteria like date).
    read the first entry. using read itab index 1

  • Last execution date and time of a transaction

    Hi,
    Could anyone let me know the procedure to find the last execution date and time of a transaction (for example MM01/MM02). We are currently working on ECC6.0
    Raja

    Hi Raja,
    Check table CDHDR, fetch data against T code MM01/MM02 and get MAX(UDATE) and MAX(UTIME).
    You will get last execution date and time.
    Please reqward ponits if it useful.
    Regards
    Krish

Maybe you are looking for

  • 6.1.2 update bricked my iPad Mini - White Screen of Death

    I updated to 6.1.2 over wireless.  Shortly after, I noticed the battery was draining extremely fast.  I followed a suggestion I found here to let the battery drain to 0 and to reset my settings under Settings>General.  When the battery was about 50%,

  • MacBook Air newbie!!

    Hi all, So I have the iPhone and iPad so thought I may as well go the whole way and get the MacBook Air which I bought this evening I have two questions... How do I sync the contacts from my iPhone to my Mac? How do I get my calendar to sync from my

  • New Battery Replacement Refuses to Charge

    I just installed a new battery in my MacBook Pro 15". It's around 2-3 years old. It's been working great, holds a charge, recharges fully, etc. I tried to charge it today after using it in classes, but it won't charge. The first indicator light is fl

  • SSH X11 server

    Hello We just received a audit finding on the solaris machine that states- the remote x11 server accepts connections from anywhere because various ports 6001, - 6009 were open. The suggested solution is to restrict access to this port by using the xh

  • Quickview acting up after update

    Since I installed the latest Mavericks update Quickview won't preview some images when I have multiple images in a folder and try to scroll through them. I'm also seeing the beach ball of death spinning an awful lo when ever I do anything in the find