A Database Error Occurred

Error Number: 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 'ORDER BY RAND() LIMIT 20' at line 7

SELECT p.id, p.name, pi.image, p.slug, p.total_rating, p.type, p.min_price, p.max_price FROM products p INNER JOIN product_images pi ON p.id = pi.product_id WHERE p.is_active = 1 AND pi.is_main = 1 AND p.vendor_id = ORDER BY RAND() LIMIT 20

Filename: H:/root/home/sonalwaya-001/www/gemsdee/system/database/DB_driver.php

Line Number: 691