MySQL Forums
Forum List  »  Newbie

Re: SELECTS
Posted by: Andrew Gilfrin
Date: July 22, 2005 07:45AM

You can select from one or more tables at once. But you need to use some sort of join between them other wise you will get a cartasian product i.e. all the rows in one table linking with all the tables in another.

So you can use for example

select e.emp_id, d.dept_id from emps e, dept d;

but this wil link all rows in emps with all rows in dept, the more logical solution is

select e.emp_id, d.dept_id from emps e LEFT JOIN dept ON e.dept_id = d.dept_id;

Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information

Options: ReplyQuote


Subject
Written By
Posted
July 22, 2005 07:20AM
July 22, 2005 07:23AM
July 22, 2005 07:30AM
Re: SELECTS
July 22, 2005 07:45AM
July 22, 2005 08:11AM
July 22, 2005 08:27AM
July 22, 2005 08:36AM
July 22, 2005 08:38AM
July 22, 2005 08:46AM
July 22, 2005 08:52AM
July 22, 2005 08:55AM
July 22, 2005 08:59AM
July 22, 2005 09:12AM
July 22, 2005 09:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.