- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
$result = $db->query("SELECT w.wine_name as wine_name,(SELECT wine_type FROM wine_type WHERE wine_id_type = w.wine_type) as wine_type,
(SELECT variety FROM grape_variety WHERE variety_id = (SELECT variety_id FROM wine_variety WHERE wine_id = w.wine_id)) AS wine_variety,
w.year as wine_year, (SELECT winery_name FROM winery WHERE winery_id = w.winery_id) as winery,
(SELECT region_name FROM region WHERE region_id = (SELECT region_id FROM winery WHERE winery_id = w.winery_id)) as winery_region,
(SELECT cost FROM inventory WHERE wine_id = w.wine_id) as wine_cost,
(SELECT on_hand FROM inventory WHERE wine_id = w.wine_id) as wine_quantity
FROM wine w
WHERE w.wine_id = '$id'");