select *,price*qty as tprice from view_pur_pr where vendor_code='0137' and request_date  
between '2007-05-26' and '2007-06-25' 
and isnull(qty,0)>0 order by order_no,request_date,item_no这个查询有几条记录查询不到如下:
         REQUEST_DATE
2 2007-06-25 17:02:12.727 0137 5881 S-65PVC树脂粉
3 2007-06-25 17:02:12.727 0137 7228 S-70PVC树脂粉

解决方案 »

  1.   

    因為2007-06-25 17:02:12.727不包括在你的時間段裡面
    select *,price*qty as tprice from view_pur_pr where vendor_code='0137' and request_date > '2007-05-25' and request_date < '2007-06-26' 
    and isnull(qty,0)>0 order by order_no,request_date,item_no
      

  2.   

    或者select *,price*qty as tprice from view_pur_pr where vendor_code='0137' and request_date  
    between '2007-05-26 00:00:00' and '2007-06-25  23:59:59' 
    and isnull(qty,0)>0 order by order_no,request_date,item_no
      

  3.   

    between '2007-05-26 00:00:00.000' and '2007-06-25 23:59:59.997'
      

  4.   

    select *,price*qty as tprice from view_pur_pr where vendor_code='0137' and convert(varchar(20),request_date,102)  
    between '2007-05-26' and '2007-06-25' 
    and isnull(qty,0)>0 order by order_no,request_date,item_no