0
votes

I tried the code below in phpmyadmin, but received a syntax error:

select * from `reviews_az` 
left join `restaurants_az` on `reviews_az`.`restaurant_id` = `restaurants_az`.`id`  
where `source` LIKE %YELP% order by `reviews_az`.`id` desc limit 6);

This is the error log:

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%YELP% order by `reviews_az`.`id` desc limit 6)' at line 1

2
Use LIKE '%YELP%' - RJParikh

2 Answers

2
votes

You are missing single quote in like.

Correct query:

select * from reviews_az left join restaurants_az on reviews_az.restaurant_id = restaurants_az.id where source LIKE '%YELP%' order by reviews_az.id desc limit 6

0
votes

Use below query. Missing quotes in LIKE.

Change

LIKE '%YELP%'

Query

select * from `reviews_az` 
left join `restaurants_az` on `reviews_az`.`restaurant_id` = `restaurants_az`.`id`  
where `source` LIKE '%YELP%' order by `reviews_az`.`id` desc limit 6;