+ 2

Combine 2 sql tabels

i have 2 tabels member (id, name, position) liga (id, liganame) i need all entrys of member to fill a pull down menu. and all entrys of liga to fill another menu. at the moment i do 2 SELECT calls and handle 2 results. i though it should be able to do this with 1 SELECT. SELECT * FROM member, liga Returns all combinations but my select should return another result. more like liga-rows are integrated in member. something like member (id,name,position,id(liga),liganame) is there i function for this?

4th May 2017, 9:56 AM
Oliver
4 Réponses
4th May 2017, 10:00 AM
Calviղ
Calviղ - avatar
+ 1
sry i dont understand your hint. if i use joins, the result is an matrix of all entrys. for example 3 entries in member an 3 in liga will return 9 rows of result. what is the advantage to use joins against use 2 selection queries?
4th May 2017, 11:08 AM
Oliver
+ 1
sry my fault, i confuse rows with columns. so the result has 9 columns not 9 rows. perhaps you can give me an example code of the join you would use to fix the problem
4th May 2017, 11:54 AM
Oliver
0
Joins operation does not increase the number of rows, it only increases the number of columns by joining the columns of 2 tables together.
4th May 2017, 11:39 AM
Calviղ
Calviղ - avatar