我现在想实现搜索今天之前的数据,可是结果就是不对(包括今天以后的数据),帮我看看到底错在哪????
select PaymentNumber,Agent,PaymentDue,Payment,LoanAmount,AmountPaid,Balance,LateFee,Payoff,PrincipalPaid,InterestPaid,GSTPaid,PSTPaid,UnPaidInt,IntDue,PaymentVia,str_to_date(replace(replace(DateDue,'PM',''),'AM',''),'%c/%e/%Y %k:%i:%s %p') as DateDue,DealNumber,DatePaid,LastPaid,if(DatePosted='$0.00','',DatePosted) as DatePosted,Last_Update_Date,Last_Update_Time,Deleted from w_oldaccounts where Deleted = 0 AND DealNumber = '23987' AND DateDue <= date_format(curdate(),'%c/%e/%Y %k:%i:%s %p') order by DateDue desc

解决方案 »

  1.   

    select PaymentNumber,Agent,PaymentDue,Payment,LoanAmount,AmountPaid,
    Balance,LateFee,Payoff,PrincipalPaid,InterestPaid,GSTPaid,PSTPaid,
    UnPaidInt,IntDue,PaymentVia,
    str_to_date(replace(replace(DateDue,'PM',''),'AM',''),'%c/%e/%Y %k:%i:%s %p') as DateDue,
    DealNumber,DatePaid,LastPaid,
    if(DatePosted='$0.00','',DatePosted) as DatePosted,
    Last_Update_Date,Last_Update_Time,Deleted 
    from w_oldaccounts 
    where Deleted = 0 
    AND DealNumber = '23987' 
    AND DateDue  <= date_format(curdate(),'%m/%d/%Y %h:%i:%s %p') 
    order by DateDue desc把'%c/%e/%Y %k:%i:%s %p'改成'%m/%d/%Y %h:%i:%s %p'.
        [align=center]====  ====
    [/align]
    .
    贴子分数<20:对自已的问题不予重视。
    贴子大量未结:对别人的回答不予尊重。
    .