Combining SQL Query Results Into One Table
I'm trying to combine queries so the results are in one table.
SELECT sku.idsku, amaterial.material
FROM sku
INNER JOIN amaterial ON sku.idsku = amaterial.sku_idsku
LIMIT 0 , 30
Produces:
idsku material
13 SteelSELECT sku.idsku, amcolor.color
FROM sku
INNER JOIN amcolor ON sku.idsku = amcolor.sku_id开发者_Go百科sku
Produces
idsku color
13 red 17 purpleSELECT sku.idsku, atype.type
FROM sku
INNER JOIN atype ON sku.idsku = atype.sku_idsku
Produces
idsku type
13 labret 17 barbellWhat I want to create is a table as follows:
idsku material color type
13 steel red labret 17 ---- purple barbellThanks in advance for your help.
what if you put all your queries into one?
SELECT sku.idsku, amaterial.material, amcolor.color, atype.type
FROM sku sku
INNER JOIN amaterial ON sku.idsku = amaterial.sku_idsku
INNER JOIN amcolor ON sku.idsku = amcolor.sku_idsku
INNER JOIN atype ON sku.idsku = atype.sku_idsku
LIMIT 0 , 30
精彩评论