Questions about a very complex MySQL query arrangement scenario

Source: Internet
Author: User
A product contains a

Item number warehouse size color number and other data
MySQL is also stored in such a field, but there is the same article number, not the same warehouse, different size situation

Now I need to select out the data format requirement is

Item No. 001 Size Color Quantity
———— Catalog No. 001 Warehouse 002 Size 1 Quantity size 2 quantity size 3 quantity
Item 2--Catalog No. 002 Size Color Quantity
———— Catalog No. 002 Warehouse 002 Size 1 Quantity size 2 quantity size 3 quantity
———— Catalog No. 002 Warehouse 003 Size 1 Quantity size 2 quantity size 3 quantity
Item 3--Catalog No. 003 Size Color
———— Catalog No. 003 Warehouse 003 Size 1 Quantity size 2 quantity size 3 quantity
....

That is, the same article number of the goods merged and then divided into different warehouses and different sizes
How would I write the SELECT statement?
I think it is to write multi-layered, the best way to be efficient?

Reply content:

A product contains a

Item number warehouse size color number and other data
MySQL is also stored in such a field, but there is the same article number, not the same warehouse, different size situation

Now I need to select out the data format requirement is

Item No. 001 Size Color Quantity
———— Catalog No. 001 Warehouse 002 Size 1 Quantity size 2 quantity size 3 quantity
Item 2--Catalog No. 002 Size Color Quantity
———— Catalog No. 002 Warehouse 002 Size 1 Quantity size 2 quantity size 3 quantity
———— Catalog No. 002 Warehouse 003 Size 1 Quantity size 2 quantity size 3 quantity
Item 3--Catalog No. 003 Size Color
———— Catalog No. 003 Warehouse 003 Size 1 Quantity size 2 quantity size 3 quantity
....

That is, the same article number of the goods merged and then divided into different warehouses and different sizes
How would I write the SELECT statement?
I think it is to write multi-layered, the best way to be efficient?

What you need to consider is the SKU

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.