A product contains data such as the size, color, and quantity of the inventory warehouse. MYSQL stores data based on such fields, but the same volume and different warehouses exist, in the case of different sizes, the data format I need to SELECT now is entry 1 -- 0000001 size color Quantity ---... a product contains
Metric data such as warehouse size and color Quantity
MYSQL stores data based on such fields, but with the same region, different warehouses, and different sizes.
The data format that I need to SELECT now is
Entry 1 -- 0000001 size color Quantity
---- 0000001 warehouse 002 size 1 quantity size 2 quantity size 3 quantity
Entry 2 -- 0000002 size color Quantity
---- 0000002 warehouse 002 size 1 quantity size 2 quantity size 3 quantity
---- 0000002 warehouse 003 size 1 quantity size 2 quantity size 3 quantity
Entry 3 -- 0000003 size color
---- 003 warehouse 003 size 1 quantity size 2 quantity size 3 quantity
....
That is to say, combine the goods of the same shard and separate the different warehouse and different sizes.
How can I write a SELECT statement?
I think it should be to write multiple layers. What is the best way to improve efficiency?
Reply content:
A product contains
Metric data such as warehouse size and color Quantity
MYSQL stores data based on such fields, but with the same region, different warehouses, and different sizes.
The data format that I need to SELECT now is
Entry 1 -- 0000001 size color Quantity
---- 0000001 warehouse 002 size 1 quantity size 2 quantity size 3 quantity
Entry 2 -- 0000002 size color Quantity
---- 0000002 warehouse 002 size 1 quantity size 2 quantity size 3 quantity
---- 0000002 warehouse 003 size 1 quantity size 2 quantity size 3 quantity
Entry 3 -- 0000003 size color
---- 003 warehouse 003 size 1 quantity size 2 quantity size 3 quantity
....
That is to say, combine the goods of the same shard and separate the different warehouse and different sizes.
How can I write a SELECT statement?
I think it should be to write multiple layers. What is the best way to improve efficiency?
What you want to consider is SKU