wiggst3r Posted January 7, 2009 Share Posted January 7, 2009 Hi I have 2 tables with information that I want to compare. Table one has 7 fields. (id, name, email, opt_in, email_opt_in, pin_number, entered_pin). Table two has 4 fields. (id, pin, to, from_name) If the pin is in table two, then it is also in table one. entered_pin is a boolean. What I want is to join the tables based on the pin field, and then see which of the pins has the entered_pin value of 1. Is this possible? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/139831-mysql-join/ Share on other sites More sharing options...
fenway Posted January 7, 2009 Share Posted January 7, 2009 Everything is possible. Try: select t2.pin from table2 as t2 inner join table1 as t1 on ( t1.pin_number = t2.pin ) where t1.entered_pin = 1 Quote Link to comment https://forums.phpfreaks.com/topic/139831-mysql-join/#findComment-731746 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.