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