私はmysqlを初めて使用するので、複数のテーブルを結合するクエリを作成する方法がまだわからないので、このクエリを作成するのに助けが必要です.
だから私はこれらのテーブルを持っています:
製品
| id | category | description | brand |
|:-----------|------------:|:------------:|:------------:|
| 1 | desktops | Hp example| HP |
| 2 | laptops | asus example| ASUS |
店舗
| id | location | Brands(physical stores) |
|:-----------|------------:|:-----------------------:|
| 1 | liverpool| currys |
| 2 | london | novatech |
| 3 | bristol | novatech |
products_stores
| id_product | id_store | price |
|:-----------|------------:|:-------:|
| 1 | 2 | 700 |
| 2 | 3 | 400 |
| 2 | 1 | 300 |
したがって、データを取得して次のように整理するクエリが必要です (すべてのデータが必要であると仮定します)。
| category | description | brand | store | location | price |
|:------------|-------------:|:------------:|:------------:|:----------:|:---------:|
| desktops | Hp example| HP | novatech | london | 700 |
| laptops | asus example| ASUS | novatech | bristol | 400 |
| laptops | asus example| ASUS | currys | liverpool | 300 |