lavercum Posted January 6, 2015 Share Posted January 6, 2015 How to link three tables ? two tables store int and the third text... $requete = "SELECT table1.ID,table2.Tid,table3.text INNER JOIN table2 ON table2.Tid=table1.ID INNER JOIN table3 where text='$something'... ? Thank's for help ! Link to comment Share on other sites More sharing options...
justsomeguy Posted January 6, 2015 Share Posted January 6, 2015 You forgot the FROM, add a FROM clause with table1. You also need to define how to join tables 1 and 2 with table 3, how does the text relate to the other records? Link to comment Share on other sites More sharing options...
davej Posted January 7, 2015 Share Posted January 7, 2015 Classic Oracle syntax: SELECT *FROM table1 t1, table2 t2, table3 t3WHERE t1.x = t2.xAND t2.x = t3.xAND any other desired limiting criteria ANSI syntax: SELECT *FROM table1 t1INNER JOIN table2 t2ON t1.x = t2.xINNER JOIN table3 t3ON t2.x = t3.xAND any other desired limiting criteria The keyword AS can be omitted as shown above. The queries above will display all columns. You can of course reduce this to a specific list of columns. Note that each additional table must have a constraining equality which ties it to another table in the join. Also these joins are inner joins -- which display only elements present in all tables -- there are other types of joins. Link to comment Share on other sites More sharing options...
lavercum Posted January 15, 2015 Author Share Posted January 15, 2015 the problem I encounter is that the selection in one table is made on a text field compared to a search word Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now