これが私の「製品」テーブルWHERE sku RLIKE 'IP-205-1067-16' or sku IN ('205-d-SC55G','205-d-RC099G','205-d-SC45G','205-d-RC099G')
です:は、テーブルを結合
+--------+-------------------+------------+-------------+--------------+
| id | imprint_method_id | name | setup_sku | running_sku |
+--------+-------------------+------------+-------------+--------------+
| 809128 | 32539 | Body Right | 205-d-SC45G | 205-d-RC059G |
| 809129 | 32539 | Body Left | 205-d-SC45G | 205-d-RC059G |
| 808288 | 63276 | Body Right | 205-d-SC55G | 205-d-RC099G |
| 808289 | 63276 | Body Left | 205-d-SC55G | 205-d-RC099G
+--------+-------------------+------------+-------------+--------------+
は、これは私が「最終的な結果である:これは私の「imprint_locations」テーブルWHERE imprint_method_id IN (63276,32539)
ある
+---------------------------+---------+-----------------------+-----------------------+-------------------------+----------------------------+
| sku | price_1 | full_color_imprint_id | embroidery_imprint_id | screen_print_imprint_id | laser_engraving_imprint_id |
+---------------------------+---------+-----------------------+-----------------------+-------------------------+----------------------------+
| IP-205-1067-16 | 1.55556 | NULL | NULL | 63276 | 32539 |
| IP-205-1067-16-39423495 | 1.55556 | NULL | NULL | 63276 | 32539 |
| IP-205-1067-16-1272347 | 1.55556 | NULL | NULL | 63276 | 32539 |
| IP-205-1067-16-56185 | 1.55556 | NULL | NULL | 63276 | 32539 |
| IP-205-1067-16-1706399150 | 1.55556 | NULL | NULL | 63276 | 32539 |
| 205-d-SC45G | 45 | NULL | NULL | NULL | NULL |
| 205-d-SC55G | 55 | NULL | NULL | NULL | NULL |
| 205-d-RC059G | 0.59 | NULL | NULL | NULL | NULL |
| 205-d-RC099G | 0.99 | NULL | NULL | NULL | NULL |
+---------------------------+---------+-----------------------+-----------------------+-------------------------+----------------------------+
達成しようとしています:
+---------------------------+-----------------------------------------+-------------------------------------------+-------------------------------------------+---------------------------------------------+----------------------------------------------+------------------------------------------------+
| sku | embroidery_imprint_id_setup_sku_price_1 | embroidery_imprint_id_running_sku_price_1 | screen_print_imprint_id_setup_sku_price_1 | screen_print_imprint_id_running_sku_price_1 | laser_engraving_imprint_id_setup_sku_price_1 | laser_engraving_imprint_id_running_sku_price_1 |
+---------------------------+-----------------------------------------+-------------------------------------------+-------------------------------------------+---------------------------------------------+----------------------------------------------+------------------------------------------------+
| IP-205-1067-16 | NULL | NULL | 55 | 0.99 | 45 | 0.59 |
| IP-205-1067-16-39423495 | NULL | NULL | 55 | 0.99 | 45 | 0.59 |
| IP-205-1067-16-1272347 | NULL | NULL | 55 | 0.99 | 45 | 0.59 |
| IP-205-1067-16-56185 | NULL | NULL | 55 | 0.99 | 45 | 0.59 |
| IP-205-1067-16-1706399150 | NULL | NULL | 55 | 0.99 | 45 | 0.59 |
+---------------------------+-----------------------------------------+-------------------------------------------+-------------------------------------------+---------------------------------------------+----------------------------------------------+------------------------------------------------+
あなたはproduct_print_im imprint_locationsテーブルのimprint_method_idと一致するprint_id。
'WHERE imprint_locations.setup_sku = CONCAT( 'setup_sku_'、product.sku)'あなたが** **コードを自分で書いてみることが予想される – Barmar
。 [もっと研究をした後](https://meta.stackoverflow.com/q/261592/1011527) 問題がある場合は**投稿した内容を投稿してください** working **と は、[最小、完全、および検証可能な例]を提供します(http://stackoverflow.com/help/mcve)。 [よくある質問のしくみ](http://stackoverflow.com/help/how-to-ask)をお読みください。 [ツアーに参加する](http://stackoverflow.com/tour)と[this](https://meta.stackoverflow.com/q/347937/1011527)を必ずお読みください。 –
Hey Barmar、ABC、およびsetup SKU ABCは架空のものです。私はhe-123-h100と呼ばれるproduct.skuと、924-geeと呼ばれるimprint_locations.setup_skuを持っています。 – Boris