troubleshooting Question

Join subqueries in Sybase

Avatar of saulius88
saulius88Flag for United Kingdom of Great Britain and Northern Ireland asked on
DatabasesSybase DatabaseSQL
22 Comments1 Solution3601 ViewsLast Modified:
Dear All,

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.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 22 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros