Re: Join vs. Where (help) -(I got it!)

2003-06-25 Thread tlr7425
Ok, should be this:

SELECT * FROM machines INNER JOIN people ON 
machines.peopleID=people.peopleID;

Ted

This:

SELECT * FROM machines INNER JOIN people ON 
machines.machinesID=people.peopleID;

Is not producing the same results as this:

SELECT lastname, model FROM people, machines WHERE machines.peopleID =
people.peopleID;
Can someone please tell why, what's wrong?

(What happens is that the wrong person are listed with the wrong 
machine -using the INNER JOIN shown above, the second statement I 
listed works as expected, right person with right machine.)

Thanks in Advance,
Ted Rogers


Re: Join vs. Where (help) -(I got it!)

2003-06-25 Thread gerald_clark
In the second query, the server may switch the order of the join, 
producing the same output in different order.
Try adding an ORDER BY to both and see what happens.

[EMAIL PROTECTED] wrote:

Ok, should be this:

SELECT * FROM machines INNER JOIN people ON 
machines.peopleID=people.peopleID;

Ted

This:

SELECT * FROM machines INNER JOIN people ON 
machines.machinesID=people.peopleID;

Is not producing the same results as this:

SELECT lastname, model FROM people, machines WHERE machines.peopleID =
people.peopleID;
Can someone please tell why, what's wrong?

(What happens is that the wrong person are listed with the wrong 
machine -using the INNER JOIN shown above, the second statement I 
listed works as expected, right person with right machine.)

Thanks in Advance,
Ted Rogers




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]