Hi,
I've had this problem for a while and I haven't seen any answers to it yet. Hope you guys know better:
I'm trying to get information to Excel by using an SQL statement that is run in Microsoft Query. Seems that MS Query doesn't follow SQL standards, because the following query gives me this error: "Unknown column hours.hourssum in 'field list'". The same query is excecuted normally in MySQL Query Browser.
I know that the query can be done a bit differently, but it's just an example of the situation I have (My real query is much longer and all the field names are in Finnish so I think the situation is more clearer in this way).
The problem is that whenever I use an alias with subqueries and try to return it back to the main query, MS Query doesn't recognize the subquery alias.
Is it even possible in MS Query to use subquery aliases in main query?
I've had this problem for a while and I haven't seen any answers to it yet. Hope you guys know better:
I'm trying to get information to Excel by using an SQL statement that is run in Microsoft Query. Seems that MS Query doesn't follow SQL standards, because the following query gives me this error: "Unknown column hours.hourssum in 'field list'". The same query is excecuted normally in MySQL Query Browser.
Code:
SELECT orders.id AS id,
hours.hourssum AS hourssum
FROM
orders LEFT JOIN
(SELECT job.id AS id, sum(job.hours1) AS hourssum from job GROUP BY job.id) AS hours ON orders.id=hours.id
WHERE orders.id = '981382';
The problem is that whenever I use an alias with subqueries and try to return it back to the main query, MS Query doesn't recognize the subquery alias.
Is it even possible in MS Query to use subquery aliases in main query?