lundi 25 juillet 2016

Mysql Alias of alias

I'm trying to run this sample query :
SELECT * FROM (SELECT * FROM orders WHERE id > 2) AS o1 JOIN o1 AS o2 ON o1.id = o2.id;

but this error occur:

Error Code: 1146 Table 'pnu.o1' doesn't exist

how should i join the sub query with itself?

Aucun commentaire:

Enregistrer un commentaire