Answer the question
In order to leave comments, you need to log in
How to get data from 2 tables under different conditions?
Good afternoon.
There are tables:
Setting - list of settings
Setting_Value - list of settings values:
domain_id (null) // Если NULL, то настройка общая, не привязана к домену
language_id (null) // Если NULL, то настройка общая, не привязана к языку
Answer the question
In order to leave comments, you need to log in
SELECT *
FROM setting_salue sv
JOIN setting s ON s.id = sv.setting_id
WHERE (sv.domain_id = DOMAIN_ID OR sv.domain_id IS NULL)
AND (sv.language_id = LANG_ID OR sv.language_id IS NULL)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question