August 8, 2012 at 3:33 pm
I'm sure this is something simple but I'm not seeing it. I'm trying to find tickets that were created on or before 2012-06-29 or if the ticket is closed the closed date is greater than or equal to 2012-06-29
My query is displaying the tickets that were created after 2012-06-29.
SELECT [Id]
,[TicketNumber]
,CRM.dbo.fn_ConvertSFDate([CreatedDate]) as CreatedDate
,CRM.dbo.fn_ConvertSFDate([ClosedDate]) as ClosedDate
FROM [Customers].[dbo].[Ticket]
Where (Open_or_Closed__c = 'Open' AND CRM.dbo.fn_ConvertSFDate(CreatedDate) <= '2012-06-29' AND [Status] NOT LIKE 'Suspended - %')
OR
(Open_or_Closed__c = 'Closed' AND CRM.dbo.fn_ConvertSFDate(ClosedDate) >= '2012-06-29' AND [Status] NOT LIKE 'Suspended - %')
ORDER BY CreatedDate desc
August 8, 2012 at 3:37 pm
littlelisa1111 (8/8/2012)
My query is displaying the tickets that were created after 2012-06-29.
Yep, this'll do that if it's closed and the closed date is after that.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply