次のような結果をもたらすクエリが必要です。
prescription created date
right lens product
left lens product
store name
is prescription used for order **Yes / no**
私のデータベーステーブルは次のとおりです。
**prescriptions**
creation_date
right_product_id
left_product_id
store_id
customer_id
**products**
id
name1
**stores**
id
name
**orders**
id
store_id
customer_id
**order_products**
id
order_id
right_product_id
left_product_id
1 つの問題はprescription_id
、注文テーブルを使用したことがないため、直接的な結果をもたらすことができないため、処方箋と注文が行われたかどうかに一致するフィールドをcustomer_id
使用する必要があることです。store_id
誰でも、上記の結果をもたらすクエリを作成してもらえますか?
結果は次のようになります。
処方日 | right_lens_product | 左レンズ製品 | ストア | 処方箋
2012/12/12 | 製品 1 | 製品 2 | xYZ ストア | はい・いいえ
早めの対応をお願いいたします。
ありがとう !