web-dev-qa-db-fra.com

Obtenez des enregistrements de la dernière heure

J'ai cette requête:

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 = ???????

J'utilise le serveur adaptatif Sybase n'importe où et j'essaie d'obtenir des enregistrements pour la dernière heure.

15
JeffreyLazo

essaye ça !!

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())
23
vhadalgi

Essayez la requête ci-dessous:

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 >= (sysdate-1/24);
0
user3540800