Created
April 23, 2012 21:49
-
-
Save jeffreyiacono/2474136 to your computer and use it in GitHub Desktop.
mysql ladder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE `ladder` ( | |
| `i` int(1) unsigned NOT NULL, | |
| PRIMARY KEY (`i`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=latin1; | |
| INSERT INTO ladder (i) VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); | |
| SELECT l1.i + l2.i * 10 + l3.i * 100 AS sequence | |
| FROM ladder l1 | |
| JOIN ladder l2 ON TRUE | |
| JOIN ladder l3 ON TRUE | |
| ORDER BY sequence DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment