SELECT products.id as my_product_id, products.name as my_product_name, stranik as page_numbers, group1 AS cost,
group_concat(bb.name) AS book_binding_name,
group_concat(bl.name) AS book_format_book_name
FROM products,product_book
INNER JOIN book_binding bb ON book_name = 'book_binding' AND bb.id = product_book.book_id
INNER JOIN book_format_book bl ON book_name = 'book_format_book' AND bl.id = product_book.book_id
INNER JOIN prices ON prices.product_id = 'Д900'
WHERE products.id = 'Д900' and product_book.product_id = products.id AND bb.id IS NOT NULL AND bl.id IS NOT NULL group by products.id
Array
(
[0] => Array
(
[0] => Array
(
[my_product_id] => ПЧ209
[my_product_name] => Зимняя сказка. Книжки маленького Ёжика
[page_numbers] => 12
[cost] => 18.00
[book_binding_name] => Мягкий
[book_format_book_name] => 275*205
)
)
)
Array
(
[0] => Array
(
)
)
Array
(
[0] => Array
(
[0] => Array
(
[my_product_id] => Д900
[my_product_name] => null
[page_numbers] => null
[cost] => null
[book_binding_name] => null
[book_format_book_name] => null
)
)
)
$firstRowProducts[] = (new Query())
->select(['products.id as my_product_id, products.name as my_product_name, stranik as page_numbers, group1 AS cost',
'CONCAT(bb.name) AS book_binding_name',
'CONCAT(bl.name) AS book_format_book_name'
])
->from(['products', 'product_book'])
->join('LEFT JOIN', 'book_binding bb', ['book_name' =>'book_binding', 'bb.id' => 'product_book.book_id'])
->join('LEFT JOIN', 'book_format_book bl', ['book_name' => 'book_format_book', 'bl.id' => 'product_book.book_id'])
->join('LEFT JOIN', 'prices', ['prices.product_id' => 'ТО400'])
->where(['products.id' => 'ТО400', 'product_book.product_id' => 'products.id'])
->groupBy('products.id')
->all();
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'products.id as my_product_id, products.name as my_product_name, stranik as page_numbers, group1' in 'field list'
Если хотите - напишите в ответ, отмечу решением.