vendredi 29 mai 2015

What kind of query do I need?

I have a table called physical_exam_tool_and_body_parts that has:

id physical_exam_tool_id body_part_id

the body_parts table has: name_tid

the physical_exam_tools table has: name_tid

The translation table looks like:

id lang text

I'm trying to query:

SELECT physical_exam_tool_text,
       body_part_text
FROM   physical_exam_tool_and_body_parts
WHERE  translation.lang = 'fr' 

I want the names of the body part and physical exam tool for the lang 'fr'. How can I do this. I'm new to joins.

body_parts and physical_exam_tools tables have:

id name_tid

name_tid is the id in the translation table. The translation table has id lang text. So the primary key for translations is a composite key (id,lang).

In physical_exam_body_part_and_tool the id's in that are just the ids (foreign keys) for the body_parts and physical_exam_tools table.

Aucun commentaire:

Enregistrer un commentaire