I have an SQLite database of phrases and their native translations in the form
code | language_id | script_source | script_target | transliteration
| | | |
yes | 1 | Yes. | Yes. | NULL
no | 1 | No. | No. | NULL
yes | 3 | Oui. | Oui. | NULL
no | 3 | Non. | Non. | NULL
where the language_id specifies the language. I am trying to write a query that SELECT
's the code, the script_source from one language and the script_target from another language as well as the transliteration, all on one row. The closest I have managed to get is
SELECT code, script_source, transliteration FROM phrases WHERE language_id=001
UNION
SELECT code, script_target, transliteration FROM phrases WHERE language_id=003;
which produces this query result:
code | script_source | transliteration
yes | Yes. | NULL
yes | Oui. | NULL
no | No. | NULL
no | Non. | NULL
This is ok, but it would be better for my purposes if the `script_target' had it's own column, like this:
code | script_source | script_target | transliteration
yes | Yes. | Oui. | NULL
no | No. | Non. | NULL
I think this will probably require a JOIN
function of some sort, but as of yet I haven't been able to get the desired result. Any help will be appreciated.
EDIT: My mistake, I want the transliteration corresponding to the script_target
value.