linux1880 Posted July 30, 2010 Share Posted July 30, 2010 Hi all, If there are a two tables in a database with primary key are they in relationship without needing to add foreign keys ? I was doing select col1, col2 from table1,table 2 it just fetch two coluns from two different tables. There was no fk. Is that possible ? Quote Link to comment https://forums.phpfreaks.com/topic/209393-relationship-between-two-tables/ Share on other sites More sharing options...
V Posted July 31, 2010 Share Posted July 31, 2010 You'll have to use something like this "SELECT table1.col1, table2.col2 FROM table1, table2" and you can use WHERE to make the relationship. "SELECT table1.col1, table2.col2 FROM table1, table2 WHERE table1.some_id = table2.some_id" Quote Link to comment https://forums.phpfreaks.com/topic/209393-relationship-between-two-tables/#findComment-1093724 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.