2011-04-13 55 views
0

我的查詢是:如何在複合查詢中加入日期函數?

SELECT 
    c.aCustID AS 'Contact ID', 
    o.[FldDate22526] AS 'Opportunity Date', 
    o.[FldNumeric22532] AS 'Opportunity Allotted to', 
    n.tOpportunityname AS 'Opportunity Name', 
    p.[FldString22540] AS 'Opportunity Phone', 
    p.[FldString22539] AS 'Opportunity Address', 
    r.[FldString22543] AS 'Opportunity Remerks (Customer Care)', 
    p.[FldString22538] AS 'Opportunity Remerks (Sales)', 
    o.[FldNumeric22536] AS 'Opportunity Status (5 Day)' 
FROM 
    tblCustomer AS c 
    JOIN [tblObjectType3_3] as o 
    ON c.aCustID = o.nID 
    JOIN tblOpportunity AS n 
    ON o.nID = n.aOpportunityID 
    JOIN [tblObjectType3_11] AS p 
    ON o.nID= p.nID 
    JOIN [tblObjectType3_2] AS r 
    ON p.nID = r.nID 
+0

你想用日期功能做什麼?順便說一句,這些是我見過的最糟糕的領域名稱..我認爲你不能改變他們:( – Blorgbeard 2011-04-13 06:32:14

回答

0

我要去猜測,所有你想要做的就是將搜索結果限制在那些日期範圍。例如:

SELECT ... 
FROM ... 
WHERE o.[FldDate22526] > sysdate 

或許

SELECT ... 
FROM ... 
WHERE o.[FldDate22526] BETWEEN now() and now()-7 

不知道哪個DB,所以不知道要使用的日期語法。