vendredi 31 juillet 2015

MySql SELECT with if statement and LIKE operator

I am working on an advertisement site.

I have one table with a column for each day. I need to check in the table which ads is saved as default to update only those ads.

I have tried this, but it not working.

SELECT Monday if (Monday LIKE '%default%'),
Tuesday if (Tuesday LIKE '%default%')
FROM `Ad_Relationshp`

MySql gives me this error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'if (Monday LIKE '%default%') FROM Ad_Relationshp LIMIT 0,' at line 1. I have tried changing the syntax to everything I can think off, but I still get the same error.

Aucun commentaire:

Enregistrer un commentaire