你好我在这里需要帮助...
我的查询显示以下结果:
Id name color Version
1 leather black 1
1 leather brown 2
2 suede brown 1
3 cloth green 1
3 cloth blue 2
我想显示以下内容:
Id name color Color_2
1 leather black brown
2 suede brown
3 cloth green blue
目前查询很简单
SELECT ID, NAME, COLOR,VERSION
FROM table1,table2
WHERE table1.ID = table2.ID
AND id in
(SELECT ID
FROM table1,table2
WHERE table1.ID = table2.ID
AND VERSION in ('1'))
AND VERSION in ('1','2')