Jump to content

Duplicate results


OriginalBoy

Recommended Posts

Hey,

 

I need to find duplicate results from different mysql tables. So I need to search the email fields in the tables and then it returns back anything thats in them all.

 

I've been looking through tutorials and here is what i have got...

 

SELECT email

FROM design3

INNER JOIN flash3

ON first_table.keyfield = second_table.foreign_keyfield

 

this dnt seem to be working i got this guide from w3schools any advice, and can I join like 3 or 4 together to search through

 

 

 

Link to comment
Share on other sites

SELECT email
FROM design3
INNER JOIN flash3
ON first_table.keyfield = second_table.foreign_keyfield

 

1. What table is the email you want to select?

2. If you're selecting from design3 INNER JOIN flash3, where did first_table and second_table come in?

Link to comment
Share on other sites

you change 'keyfield' to the field of the first table that corresponds to the 'foreign_keyfield' of the second table

 

edit:

for instance, if you have a table "classes"...

classID/className

1/math

2/science

3/english

 

and you have a if you have a table "students"...

 

classID/name

3/john

1/jane

3/carl

 

the query SELECT * FROM students INNER JOIN classes ON students.classID = classes.classID

 

would return a table connecting the students to their respective classes... eg carl (in the result column students.name) would be on the same result row as english (in the result column classes.className).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.