So I'm on this databse project for my school and I'm having some trouble with getting the right query. What I have is this:
SELECT bezoeker.voornaam, bezoeker.tussenvoegsel, bezoeker.achternaam, bezoeker.woonplaats AS uit, route.film_1 as 'Film 1', route.bios_1 as 'bioscoop 1', route.film_2 as 'Film 2', route.bios_2 as 'bioscoop 2', route.film_3 as 'Film 3', route.bios_3 as 'bioscoop 3', route.film_4 as 'Film 4', route.bios_4 as 'bioscoop 4', route.film_5 as 'Film 5', route.bios_5 as 'bioscoop 5'
FROM bezoeker, route
WHERE route.routenr=bezoeker.routenr
ORDER BY bezoekersnr;
Nou this pops up all records from the table 'bezoeker' and some fields of it, followed by a bunch of numbers (from the table 'route' which holds numbers for 'bioscoop_1' ~ 'bioscoop_5' as well as 'film_1' ~ 'film_5')
Now I have two other tables called 'bioscoop' and 'film.'
For example I will use the table 'film'
Film's contents are something like this:
filmnr | titel
1 | Juno
2 | Eastern Promises
Now when in my query I show 'route.film_3' it shows a number, for example '2'
What I want to do is not show that number but show the text that is in the field of 'titel' in the table 'film' where 'filmnr' is 2. So in this case it would show Eastern Promises
And so on for all fields: film_1, film_2, film_3, film_4 and film_5.
Same goes for bioscoop. Bioscoop has 'bioscoopnr' and 'naam.' And I want it to show what's under the field 'naam' for the corresponding 'bioscoopnr'
My question is: is this possible in one query? (so no messing around with php or whatever. I need to be able to open access or another database tool, enter this one query and get the desired result) And if it is possible, can someone help me with it?
Thanks in advance.
I hope I made clear what my problem is. Below is an image about how relations should be.
