I have 2 tables: table "clients" and table "area".
Clients table:
Client_number
Client_name
Client_language
Area_number
1
Walter
Dutch
A1
2
Maya
French
B1
3
Tom
French
C1
Area table:
Area_number
Area_name
Area_language
A1
Moeskroen
Dutch
A1
Mouscron
French
B1
Meyerode (Saint Vith)
French
B1
Meyerode (Sankth Vith)
German
C1
Bullingen
German
In the result of the query I want to display the area_name that corresponds with the client_language from the clients table. So the result of the query must look like this:
Client_number
Client_name
Client_language
Area_number
Area_name
1
Walter
Dutch
A1
Moeskroen
2
Maya
French
B1
Meyerode (Saint Vith)
3
Tom
German
C1
Bullingen
Someone who can help me with the query?
Thanks a lot
Well, I am new to this query writing so i would join the tables like this:
select A.client_number, A.client_name, A.client_language, A.area_number, B.area_name
from
(select *
from clients) A
left join
(select *
from area) B
on A.area_number = B.Area_number
But how to incorporate the area_name selection based on the language of the client is a step to far for me at the moment But I want to learn
Thanks but I don't see any selection of area_name based on the language of the client. But maybe I explained it wrong.
Client 1 (Walter) speaks Dutch (= client_language) and he lives in area A1. This Area is named Moeskroen in Dutch language and Mouscron in French (2 lines in area table for area A1).
Since Walter speaks Dutch, I want to see "Moeskroen" in the result table.