Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL - Join Tables and show "empty" values too

Tags:

mysql

i have a question. i have one table with interface strings (interface_string_id, name), i.e. 181 - SEARCH, 183 - SEARCH_NOT and so on

and a second table with the language translation strings (language_id, interface_string_id, string), ie. cz - 181 - hledáni, 183 - cz - nehledat, de - 181 - suche, de - 183 - nicht suchen.

now i want to build a table with join where i also want to create "empty" rows for interface string, which are still missing.

is there a way how i can achieve this?

also, is that way the tables were built better or worse in performance (the structure side IMO is awful).

peace, jesta

like image 210
JestaBlunt Avatar asked Mar 03 '26 13:03

JestaBlunt


1 Answers

Use a LEFT JOIN to show fields from both tables, including ones with empty or null values.

select
lt.language_id,
lt.interface_string_id,
lt.string,
i.name
from language_translation_string lt
left join interface_string i on i.interface_string_id = lt.interface_string_id 
like image 136
Donal Avatar answered Mar 05 '26 03:03

Donal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!