How can one select a row from an SQL table in n-times? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can one select a row from an SQL table in n-times?

Using two tables in the same database

13th Apr 2017, 9:47 PM
Temitope Olamilere
Temitope Olamilere - avatar
1 Answer
+ 4
i am not sure that i understand what your question about. but i try to explain how i understud. a table "team" has row "goalkeeperid"(freign key table member), "defenceid" (foreign key table member) and id (primary key). table member has a row id and name. you want to know the names of the goalkeeper and defenceplayer. SELECT m.name as namegoal, ma.name as namedefence FROM team as t, member as m, member as ma WHERE m.id = t.goalkeeperid and ma.id = t.degenceid perhaps your problem could be solved with the hint that your could insert the same row with different alias in FROM part of your sql
15th Apr 2017, 6:55 AM
Oliver