Hello
I'm trying to cross join two tables and get a certain order in the returned records.
when I do
select * from a,b;
i get
+------+------+
| x | z |
+------+------+
| 1 | a |
| 2 | a |
| 3 | a |
| 1 | b |
| 2 | b |
| 3 | b |
| 1 | c |
| 2 | c |
| 3 | c |
| 1 | d |
| 2 | d |
| 3 | d |
+------+------+
and I'd like something like
+------+------+
| x | z |
+------+------+
| 1 | a |
| 2 | b |
| 3 | c |
| 1 | d |
| 2 | a |
| 3 | b |
| 1 | c |
| 2 | d |
| 3 | a |
| 1 | b |
| 2 | c |
| 3 | d |
+------+------+
I tried many variations of joins but with no luck. Documentation does not say much about order of records.
Can this be done?
Thanks
my table are:
CREATE TABLE `a` (
`x` int(11) default NULL
);
CREATE TABLE `b` (
`z` char(1) default NULL
);
with the data:
select * from a;
+------+
| x |
+------+
| 1 |
| 2 |
| 3 |
+------+
select * from b;
+------+
| z |
+------+
| a |
| b |
| c |
| d |
+------+
version 5.0.77
Edited 1 time(s). Last edit at 06/11/2010 09:02AM by Liviu Vasut.