web-dev-qa-db-ja.com

過去1時間のレコードを取得する

私はこのクエリを持っています:

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

どこでもSybase適応型サーバーを使用して、過去1時間のレコードを取得しようとしています。

15
JeffreyLazo

これを試して !!

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

以下のクエリを試してください:

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