The below code works but when i change Order by id to Order by s.id, i get this error
Unknown column 's.id' in 'order clause'
$construct = "SELECT child.* FROM products child LEFT JOIN products parent on parent.name=child.parent INNER JOIN subscribe s ON (s.productid = parent.id) WHERE s.username='$logged' AND s.type='0'
UNION
SELECT child.* FROM products child LEFT JOIN products parent on parent.sid=child.sid INNER JOIN subscribe s ON (s.productid = parent.id) WHERE s.username='$logged' AND parent.keyword != child.name AND s.type='1'
ORDER BY s.id DESC";
How can i change the code so it is ordered by s.id, which is the subscribe table's id?