Reputation: 13
I am trying to make a query that get the information from these tables. Now by simply using Select * from Kamp;
I get all the information I want, but as integers as that's what I have selected the columns to be in the Kamp
Table. But that doesn't give any useful/meaningful information for people who does not know what each integer represents.
What I am looking for is a query that gets the information from each table, connected to the integer displayed in the Kamp
table so that I can get a complete and meaningful output on the website.
For example:
I want Deltaker1
and Deltaker2
(Participant 1 and 2) in Kamp
to display Fornavn
+ Etternavn
(Firstname + Lastname) from Trener
, Arena
in Kamp to display Type
+ Adresse
from Stadio
. I have tried to inner join the tables, but I still end up with the integers.
Hope someone can help me :)
Upvotes: 1
Views: 65
Reputation: 133400
You can use Join
select k.Deltaker1, k.Deltaker2,
t1.Fornavn, t1.Etternavn,
t2.Fornavn, t2.Etternavn,
s.type, s.Addresse
from Kamp as k
inner join Stadio as s on s.Stadio_id = k.Arena
inner join Trener as t1 on t1.Trener_id = k.Deltaker1
inner join Trener as t2 on t2.Trener_id = k.Deltaker2
Upvotes: 2