mercredi 19 juillet 2017

SUBSTR() function in IF statement MYSQL

Query:

SELECT if(substr(link, 1, 2)='y_', 'https://www.youtube.com/watch?v='substr(link,3), 'https://vimeo.com/'substr(link,3)) as link, `title`
FROM `video`
WHERE `reg_id` = '101'  

In the above query I can't use substr(link,3) function when expression is true. After v= I wanna get a sub string value of link column in the table.

The above query fire some error. So please help me to solve this issue. Answers will be appreciated.

Aucun commentaire:

Enregistrer un commentaire