Is it possible to get some result like this from 2 tables: ps: warehouse 1,... I mean all of my warehouses
right now im doing a for loop and getting data for each sku like this:
first getting all products from products table:
SELECT id, sku FROM products
then do a for loop on this:
SELECT ware.id, ware.name, ware_inv.available as inventory,
ware_inv.id as inventoryName, ware.country
FROM warehouses as ware JOIN warehouse_inventory as ware_inv
ON ware.id = ware_inv.warehouse_id
WHERE ware.store_id = $1
AND ware_inv.sku = $2
warehouse table schema:
warehouse inventory table schema:
warehouse_id inside warehouse_inventory is foreign key to warehouses table.