OriginalBoy Posted August 31, 2008 Share Posted August 31, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/ Share on other sites More sharing options...
cooldude832 Posted August 31, 2008 Share Posted August 31, 2008 are Table 1 and Table 2 identical tables? Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-630147 Share on other sites More sharing options...
OriginalBoy Posted August 31, 2008 Author Share Posted August 31, 2008 Yes they are Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-630198 Share on other sites More sharing options...
Ken2k7 Posted August 31, 2008 Share Posted August 31, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-630210 Share on other sites More sharing options...
genericnumber1 Posted August 31, 2008 Share Posted August 31, 2008 yeah, you'll need to change ON first_table.keyfield = second_table.foreign_keyfield to match your table's layout.. maybe something like ON design3.id = flash3.id ? Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-630219 Share on other sites More sharing options...
OriginalBoy Posted August 31, 2008 Author Share Posted August 31, 2008 Ok I kinda get it the email is in both tables and I need to find it if any are in both Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-630221 Share on other sites More sharing options...
Ken2k7 Posted August 31, 2008 Share Posted August 31, 2008 SELECT design3.email FROM design3 INNER JOIN flash3 ON design3.keyfield = flash3.foreign_keyfield ? Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-630222 Share on other sites More sharing options...
OriginalBoy Posted September 1, 2008 Author Share Posted September 1, 2008 SELECT design3.email FROM design3 INNER JOIN flash3 ON design3.keyfield = flash3.foreign_keyfield ? I get this back... #1054 - Unknown column 'design3.keyfield' in 'on clause' Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-631174 Share on other sites More sharing options...
genericnumber1 Posted September 1, 2008 Share Posted September 1, 2008 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). Quote Link to comment https://forums.phpfreaks.com/topic/122064-duplicate-results/#findComment-631229 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.