Code:SELECT Ord.orderID, Ord.DateCreated, Ord.DateShipped, Ord.OrderTotal, Ord.Subtotal, Ref.UrlReferrer AS Referrer FROM customer_Orders AS Ord INNER JOIN customer_WebStatistics AS Ref ON Ord.IPAddress = Ref.IPAddress WHERE (Ord.DateShipped >= @StartDate AND Ord.DateShipped <= @EndDate) AND Ord.IPAddress IN ( SELECT IPAddress FROM customer_WebStatistics WHERE UrlReferrer <> @CurrentDomain AND Ref.EnterDate = Ord.DateCreated )
I am aware that this will not work as expected. However i wanted to give you an idea of what i am trying to achive here.
Basically i want to returns all orders no matter if there is Referrer or NO.
The referrer should be included ONLY if it happened on the same date with the order AND if UrlReferrer contains the Request.ServerVariables("SERVER_NAME").
Thanks for any ideas





Reply With Quote