Answer the question
In order to leave comments, you need to log in
How to make a selection from 2 tables using the Bitrix API?
For example, there is a table (IB) with fruits, where fruit names are stored
fruit
fruit1
fruit2
There is also a table (IB Highload, all fields linked to IB above)
fruit similar others
fruit 1 fruit5 fruit8
fruit 1 fruit3 fruit1
fruit 2 fruit6 fruit2
fruit 2 fruit4 fruit6
You need to select from the table similar for fruit 1, similar for fruit 2, others for fruit 1 and others for fruit 2
, I do this, for example, similar for fruit1
Table2::getList(array(
'select' => ['*'],
'filter' => 'фрукт1',
));
//результат массив с id, но нужно же получить имена фруктов,
//поэтому делаю второй запрос
Table1::getList(array(
'select' => ['*'],
'filter' => [ID=>'массив id похожих'],
));
//аналогичным образом делаю для остальных вариантов
Answer the question
In order to leave comments, you need to log in
Look here https://dev.1c-bitrix.ru/learning/course/index.php...
In fact, you need to form a query in Table1 and attach Table2 to it, then you can collect in one query from 2 tables with all required fields.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question