1
Vote

problem with T-SQL query on SQL Server 2008

description

Hello,

I have an error message on one of my t-sql queries in my PHP code, and I not find the error so if anyone can help me

SELECT dbo.GROUP_CONCAT("<span style=color:", IF([dbo].events_categories.color IS NOT NULL, [dbo].events_categories.color, "#000000"), ";>" + [dbo].events.name, "</span>") ORDER BY [dbo].calendar.event_time ASC SEPARATOR "$$" as cnt, [dbo].calendar.event_date, dbo.GROUP_CONCAT([dbo].events.id + "===" + [dbo].events.description) ORDER BY [dbo].calendar.event_time ASC SEPARATOR "$$") as id_description, SUBSTRING([dbo].calendar.event_date, 9, 2) as day FROM [dbo].calendar INNER JOIN [dbo].events ON [dbo].calendar.event_id = [dbo].events.id LEFT OUTER JOIN [dbo].events_categories ON [dbo].events.category_id = [dbo].events_categories.id WHERE SUBSTRING([dbo].calendar.event_date, 1, 4) = '2015' AND SUBSTRING([dbo].calendar.event_date, 6, 2) = '07' AND SUBSTRING([dbo].calendar.event_time, 4, 2) = '00' AND SUBSTRING([dbo].calendar.event_time, 1, 2) < '22' GROUP BY SUBSTRING([dbo].calendar.event_date, 9, 2)

[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near the keyword 'IF'.

GROUP_CONCAT function I installed it and tested it on.

THANK YOU

comments