[英]Pivot table in sql server 2005
This is my record in my table 这是我在桌子上的记录
GuestName F1 H1 F2 H2 F3 H3
Ryan Palma 1200 Room 12 SC 14 VAT
Richard Palma 1500 Room 15 SC 17 VAT
Ruth Palma 1600 Room 16 SV 18 VAT
I want an output like this 我想要这样的输出
GuestName Room SC VAT
Ryan Palma 1200 12 14
Richard Palma 1500 15 17
Ruth Palma 1600 16 18
How can i do this using query, 我怎么能用查询来做到这一点,
Thanks in advance, any help is appreciated 在此先感谢,任何帮助表示赞赏
你可以试试这个
select guestname,f1 as Room,f2 as SC,f3 as VAT from table
您可以使用此查询执行此操作: -
Select GuestName, F1 as Room, F2 as SC, F3 as VAT from your_table_name;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.