SELECT
shop_items_catalog_item_id as item_id,
shop_items_catalog_marking as item_num_in,
shop_items_catalog_name as item_name,
shop_vendorcode as vendor,
round(((SELECT shop_warehouse_items_count
FROM shop_warehouse_items_table
WHERE
shop_warehouse_id = 3 AND
shop_items_catalog_item_id = item_id)
+
(SELECT shop_warehouse_items_count
FROM shop_warehouse_items_table
WHERE
shop_warehouse_id = 4 AND
shop_items_catalog_item_id = item_id)
+
(SELECT shop_warehouse_items_count
FROM shop_warehouse_items_table
WHERE
shop_warehouse_id = 5 AND
shop_items_catalog_item_id = item_id
)),0) as total_count,
round((SELECT shop_warehouse_items_count
FROM shop_warehouse_items_table
WHERE
shop_warehouse_id = 4 AND
shop_items_catalog_item_id = item_id
),0) as bm,
round((SELECT shop_warehouse_items_count
FROM shop_warehouse_items_table
WHERE
shop_warehouse_id = 5 AND
shop_items_catalog_item_id = item_id
),0) as mm,
round((SELECT shop_warehouse_items_count
FROM shop_warehouse_items_table
WHERE
shop_warehouse_id = 3 AND
shop_items_catalog_item_id = item_id
),0) as sklad,
(SELECT shop_prices_to_item_value
FROM shop_prices_to_item_table
WHERE
shop_list_of_prices_id = 4 AND
shop_items_catalog_item_id = item_id
) as price_p,
(SELECT shop_prices_to_item_value
FROM shop_prices_to_item_table
WHERE
shop_list_of_prices_id = 5 AND
shop_items_catalog_item_id = item_id
) as price_r
FROM
`shop_items_catalog_table`
WHERE
users_id = 19 |