Tekky Posted August 3, 2022 Share Posted August 3, 2022 Hello, i need to compare two tables together. Here's my objective : One column in "a" database is named "Saint". And one column in "b" database is named "Nom". If for exemple, in the column of "a" is the name "test", then it has to look in database "b" and look for the same name. If the same name is on the database b, then i need to get the data (it's an url) of another column in the database b and use it as a href. I already know how to use the href in the project and the rest is done, both database are made and forms ready to insert new data in both but i'm a bit stuck on this problem Quote Link to comment https://forums.phpfreaks.com/topic/315132-double-database-comparaison/ Share on other sites More sharing options...
ginerjm Posted August 3, 2022 Share Posted August 3, 2022 So you want to do a query against 2 tables that exist in separate databases. No big deal. Make it look simpler. You want to query for a value in one table and see if it is contained in some record in the other table. Except for the referencing of the different db name, what is the real problem here? There's got to be more of an issue. Quote Link to comment https://forums.phpfreaks.com/topic/315132-double-database-comparaison/#findComment-1598921 Share on other sites More sharing options...
Barand Posted August 3, 2022 Share Posted August 3, 2022 select a.saint, b.url from the tables joined on a.saint = b.nom PS if you always want the a.saint value even if there is no matching b records, use a LEFT JOIN b Quote Link to comment https://forums.phpfreaks.com/topic/315132-double-database-comparaison/#findComment-1598922 Share on other sites More sharing options...
Tekky Posted August 4, 2022 Author Share Posted August 4, 2022 11 hours ago, Barand said: LEFT JOIN b i don't understand this part, what is a LEFT JOIN? Quote Link to comment https://forums.phpfreaks.com/topic/315132-double-database-comparaison/#findComment-1598934 Share on other sites More sharing options...
Barand Posted August 4, 2022 Share Posted August 4, 2022 Time to do some reading here Quote Link to comment https://forums.phpfreaks.com/topic/315132-double-database-comparaison/#findComment-1598936 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.