一行有2个相同名称的列

时间:2011-04-11 14:55:17

标签: sql

我希望结果集包含来自同一列的2列数据。

select cust,date,data 
from cust_a1 where ai_code between '17' and '19';

这将返回多行

1234567 | 04-04-2011 | special offer
1234567 | 04-04-2011 | cheep offer
1345678 | 04-04-2011 | friday offer
1345678 | 04-04-2011 | special offer

我想像这样塑造:

1234567 | 04-04-2011 | special offer | cheep offer
1345678 | 04-04-2011 | special offer | friday offer

如何做到这一点?

1 个答案:

答案 0 :(得分:0)

这通常称为PIVOT