You need to JOIN
the tables and then you can ORDER BY
any column. Alias the tables as p
and d
.
SELECT d.iddepto, d.ideptto, p.iproducto, p.name, p.descripcion
FROM depto d
JOIN producto p ON d.iddepto = p.iddepto
WHERE p.descripcion like '%'
ORDER BY p.iddepto ASC
WARNING: Please note that you have a SQL injection vulnerability in your code. You should sanitize your input for sSearch
, columna
, and sSortDir_0
.