Answer the question
In order to leave comments, you need to log in
Is it possible to conditionally execute an inner join?
There are tables such as:
id | number | type | status
-----------------------------------
1 | 777777 | 1 | send
2 | 777778 | 2 | send
3 | 777779 | 3 | send
tab2:
id | number | comment
-----------------------------------
1 | 777777 | comment1
2 | 777778 | comment2
3 | 777779 | comment3
id | number | type | status | comment
------------------------------------------------------
1 | 777777 | 1 | send | comment1
2 | 777778 | 2 | send (нет поля comment)
3 | 777779 | 3 | send (нет поля comment)
Получить * из tab1 и если tab1.type = '1' inner join tab2 on tab1.number = tab2.number else не добавлять
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question