Skip to content

Instantly share code, notes, and snippets.

@zzzeek
Created June 4, 2013 22:32
Show Gist options
  • Select an option

  • Save zzzeek/5710206 to your computer and use it in GitHub Desktop.

Select an option

Save zzzeek/5710206 to your computer and use it in GitHub Desktop.
Does this SQL work on your database? Need to know for older database versions!!
Postgresql 9.1.4: Y
Oracle 10: Y
SQL Server 2008: Y
MySQL 5.5.15: Y
SQLite 3.7.15: N
MySQL 4.??
MySQL 5.??
Postgresql 8.??
Postgresql 7.??
SQL Server 2005?
SQL Server 2000?
Oracle 8?
Oracle 9?
create table a(id integer);
create table b(id integer);
create table c(id integer);
select a.id, b.id, c.id from a join (b join c on b.id=c.id) on b.id=a.id;
@acslater00

Copy link
Copy Markdown

5.1.68 - Y

@franzliedke

Copy link
Copy Markdown

Works on MySQL 5.5.24.

@dairiki

dairiki commented Jun 4, 2013

Copy link
Copy Markdown

MySQL 5.1.66: Y
MySQL 5.0.51a: Y

@zzzeek

zzzeek commented Jun 4, 2013

Copy link
Copy Markdown
Author

great so we should be mostly out of the woods for MySQL.

@christianmlong

Copy link
Copy Markdown

Oracle 9.2.0.8.0 Y

@ods

ods commented Jun 5, 2013

Copy link
Copy Markdown

MySQL 5.1.30: Y

@kbower

kbower commented Jun 5, 2013

Copy link
Copy Markdown

Oracle 8 doesn't support ANSI "join" keyword. Is there an alternative sql you'd like me to attempt for 8i?

@zzzeek

zzzeek commented Jun 8, 2013

Copy link
Copy Markdown
Author

Well on Oracle 8 we actually rewrite joins as "x = y" and outer joins with "x(+) = y" (or whatever it is). I'm not sure how great this old rewriting logic scales out in any case. I'll have to test to see waht it does when you give it a join (b join c), we might be OK.

@zzzeek

zzzeek commented Jun 8, 2013

Copy link
Copy Markdown
Author

we're fine on oracle 8 (I think). Had to tweak it a bit but it just flattens out the joins as usual.

@kbower

kbower commented Jun 10, 2013

Copy link
Copy Markdown

I've been amazed at how well sqlalchemy does this for Oracle 8. We have customers using it extensively.

@untulis

untulis commented Jun 22, 2013

Copy link
Copy Markdown

Late to the party, but postgresql 8.3.23: Y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment