Joining and then ordering by a common column




I have mysql 4.0.something (so I can't do subselects).

I think this is a common question:

I have 2 tables, they each have a column called "age" (float not null).
The two tables are in no way related to each other, neither has the
primary of the other.

I want to do one select which gives me every record in both tables,
once. Why would I want that rather than doing two selects? Well I
want to "cross-order" them by age. Like the following:

SELECT * from tableA, tableB ORDER BY age LIMIT 10, 50;

You immediately see the problem. The "age" column is unqualified. But
I WANT it to be unqualified- they both have an "age", and I want get a
list of results sorted by age.

Also, the other problem is I get more results than I want. For every
tableA record, I get every tableB record as well. I know that's the
nature of joining, but that's not what I want. This doesn't seem like
such a wierd thing I'm trying to do here!

.



Relevant Pages

  • Strange Behaviors
    ... I can take my app and install it on multiple ... I am using MySQL 4.0.17 with VB.NET 2003. ... column that stores the Age. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How do you get someones age from DOB?
    ... > Dangit I thought I could do THIS simple task today and even this is ... If you're using mysql to get the "birth" field, why not add a field in ... FLOOR- DOB)/10000) AS age ... Justin Koivisto, ZCE - justin@xxxxxxxxx ...
    (comp.lang.php)
  • Age from date field?
    ... date column in mysql... ... as long as I can expect it to work on paid hosts... ... Notice that I'm only looking for the age in years... ... // DvDmanDT ...
    (php.general)
  • Re: [PHP] Age from birthdate?
    ... AS age ... will work for MySQL, where "dob" is your DATE date of birth column. ...
    (php.general)