notstock78
Technical User
In my database I have a new entry entered automatically every so often. The entry does not have a specific time that it enters but the time it is entered is kept track of. I am trying to pull the most recent entry to the database using MSSQL but I cannot get it correct. I have pulled all the entries for the last hour and even down to the last 1/2 hour but this will still not pull all the records that I am looking for because some times it takes 3 hours to get one entry and sometimes I will get 6 in 1 hour.
this table keeps track of different positions of our vehicles with satalite positioning. We have many different vehicles with each there own ID. There is another column with the date and time when the truck was pinged. This is what I have so far.
select POSHIST.processed, POSHIST.tmwin_loc, MOBILE_DEVICE.ASSIGNED_TO
from POSHIST, MOBILE_DEVICE
where POSHIST.DEVICE=MOBILE_DEVICE.DEVICE_ID
AND PROCESSED BETWEEN CURRENT TIMESTAMP - 1 hours AND
CURRENT TIMESTAMP + .25 hours
ORDER BY ASSIGNED_TO
I am sure you already know that the PROCESSED is the date and time stamp that the truck is pinged and the MOBILE_DEVICE.ASSIGNED_TO is the truck ID.
this table keeps track of different positions of our vehicles with satalite positioning. We have many different vehicles with each there own ID. There is another column with the date and time when the truck was pinged. This is what I have so far.
select POSHIST.processed, POSHIST.tmwin_loc, MOBILE_DEVICE.ASSIGNED_TO
from POSHIST, MOBILE_DEVICE
where POSHIST.DEVICE=MOBILE_DEVICE.DEVICE_ID
AND PROCESSED BETWEEN CURRENT TIMESTAMP - 1 hours AND
CURRENT TIMESTAMP + .25 hours
ORDER BY ASSIGNED_TO
I am sure you already know that the PROCESSED is the date and time stamp that the truck is pinged and the MOBILE_DEVICE.ASSIGNED_TO is the truck ID.