Get records from last hour

JeffreyLazo picture JeffreyLazo · Nov 2, 2013 · Viewed 70.8k times · Source

I have this query:

SELECT Field1, OrderFor, Writeback, Actshipdate, Orderstatus, receivedate, receivetime
FROM orderinfo, shippinginfo
WHERE orderinfo.orderid = shippinginfo.orderid
AND shippinginfo.custid = '37782'
AND receivedate =  DATE(NOW())
AND receivetime = ???????

I am using Sybase adaptive server anywhere and trying to get records for the last hour.

Answer

vhadalgi picture vhadalgi · Nov 2, 2013

try this !!

SELECT Field1, OrderFor, Writeback, Actshipdate, Orderstatus, receivedate, receivetime
    FROM orderinfo, shippinginfo
    WHERE orderinfo.orderid = shippinginfo.orderid
    AND shippinginfo.custid = '37782'
    AND receivedate =  DATE(NOW())
     AND receivetime > DATEADD(HOUR, -1, GETDATE())