我对SQL比较陌生。我试图弄清楚如何满足此条件:customer_id, customer_last_name,order_id,order_item_id, product_name为居住在弗吉尼亚州的所有客户提供展示。
customer_id, customer_last_name,order_id,order_item_id, product_name
到目前为止,我已经知道了,但是我不确定如何一起显示这些值。任何帮助将不胜感激。
SELECT customer_id, cust_first_name FROM demo_customers WHERE cust_state= 'VA' SELECT order_id FROM demo_orders WHERE customer_id= '1'
你需要一个 JOIN
JOIN
SELECT customer_id, cust_first_name, order_id, order_item_id, product_name FROM demo_customers INNER JOIN demo_orders on demo_orders.customer_id = demo_customers.customer_id WHERE cust_state= 'VA'