Join subqueries in Sybase
Posted on 2009-12-21
I know SQL reasonably well, but am working with a Sybase server for the first time. I am wondering if there are aspects of it that are different than MySQL or Access.
I am trying to execute something along the lines of:
SELECT * FROM (SELECT 0, count(broker_id), year(tmstmp) as yr FROM orders WHERE broker_id=0 GROUP BY year(tmstmp)) as t1 INNER JOIN (SELECT 1, count(broker_id), year(tmstmp) as yr FROM orders WHERE broker_id=1 GROUP BY year(tmstmp)) as t2 ON t1.yr=t2.yr
It is starting to look like a SELECT subquery can't be the used in the FROM clause. Is that the case in Sybase and why? If so, how can I join manipulated tables?
Thanks in advance.