mardi 24 février 2015

Multilayer querying in MySQL

Beginner here*. I have a table where user is allow to run query on. However in my system, I'm allowing user to run query on the table and then running another query using the same previously queried results.



SELECT * FROM employees WHERE jobTitle = 'Sales Rep'
SELECT * FROM employees WHERE officeCode = '1'


Previously with SQLite syntax I was able to achieve this by manipulating the both query into



SELECT * FROM (SELECT * FROM employees WHERE jobTitle = 'Sales Rep') WHERE officeCode = '1'


However, I've tried this same method in MySQL and I'm getting the error:



#1248 - Every derived table must have its own alias


Is there a different syntax or is it not possible at all in MySQL?


Aucun commentaire:

Enregistrer un commentaire