wesley Posted December 14, 2015 Share Posted December 14, 2015 Hello, I want to show data from three tables with a join, but it doesn't work. I have three tables: linktable, friends and carbrands. The columns are friendnumer, lastname and carbrands. The table linktable must show: column friendnumber. The table friends must show: column lastname and table carbrands must show column brand. my sql is: SELECT friendnumber,lastname, brand From linktable,friends,carbrands WHERE linktable.friendnumber = friends.lastname and friends.lastname = carbrands.brand ; what is going wrong? can someone help me? thanks in advance. Link to comment Share on other sites More sharing options...
dsonesuk Posted December 14, 2015 Share Posted December 14, 2015 It seems strange to compare friendnumber, number? With lastname to me? A number to a string? Link to comment Share on other sites More sharing options...
john_jack Posted December 16, 2015 Share Posted December 16, 2015 check this http://www.w3schools.com/sql/sql_join.asp Link to comment Share on other sites More sharing options...
justsomeguy Posted December 16, 2015 Share Posted December 16, 2015 WHERE linktable.friendnumber = friends.lastname and friends.lastname = carbrands.brandSo, linktable.friendnumber, friends.lastname, and carbrands.brand all hold the same value? That sounds like 3 completely different names for the same value, but you're telling SQL to return rows where all of those fields have the same value. 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