Darryl,

The following query would return all rows in employee that existed in emp2
(**Assuming 'employee' and 'emp2' have a common field 'key').

   SELECT e1.* FROM employee AS e1, emp2 AS e2 WHERE e1.key = e2.key;

There is a great book that introduces SQL (SQL-1 and SQL-2 concepts) titled
"The Practical SQL Handbook" (ISBN: 0-201-44787-8), which I've kept in my
library since college. If you're in the mood, thumb through it.

Regards,
Adam

-----Original Message-----
From: Darryl Hoar [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 2:58 PM
To: [EMAIL PROTECTED]
Subject: Select statement


Greetings,
I am just trying to wrap my brain around joins.

I have a table employee.  For each record in employee, I want to see
if a record exists in table emp2 based on a field value in both tables.  IE,

for each employee
  for each emp2
     if employee.field1 = emp2.field3 then
        do something interesting.
   end emp2 loop
end employee loop.


can someone point me to the right join syntax to get this done ?

thanks,
Darryl


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

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

Reply via email to