Erro: 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 ordenacao ASC, RAND() LIMIT 3' at line 11

SQL: SELECT * FROM ( SELECT *,'0' as ordenacao FROM products WHERE id IN ( SELECT related_id FROM products_related WHERE product_id = '' ) UNION SELECT *,'1' as ordenacao FROM products WHERE category_id = '' ) as tb WHERE id != ORDER BY ordenacao ASC, RAND() LIMIT 3

Filename: www.ciadasprateleiras.com.br/index.php

Timestamp: May 21, 2012, 3:19 am

Server/User:localhost/cia2

IP:38.107.179.208