SELECT CTT.BAN, `Company`, `CID`, `FName`, `MInit`,
`LName`, `OName`, `Address`, `City`, `State`,
`PostalCode`, `ActiveDate`, `ClosedDate`, `Draft`,
`Credit`, `BillingCycle`, `BillingFreq`, `Suspended`,
`Paperless` , BTT.Bal
FROM CustomerT CTT
JOIN BalanceT BTT
ON (CTT.BAN = BTT.BAN)
WHERE `Paperless` != '1'
AND `BankDraft` != -1
AND `CreditCard` != -1
AND (`BillingCycle` = '1' OR `BillingCycle` = '0')
AND `Bal` > 2
AND (`AccountClosedDate` IS NULL OR
DATE(`AccountClosedDate`) >= (NOW() - INTERVAL 180 DAY) )
一切與這個查詢,但180日期peice我已經嘗試了幾個東西從這個網站,沒有運氣。我只需要在表中包括最近6個月的閉帳額。無法獲得180天的SQL日期工作
是不是應該**> = **(NOW() - 間隔180天) - 我的意思是AccountClosedDate大於,不少於180天前? –