Getting Null data while using PIVOT in sql server 2008 R2(在 sql server 2008 R2 中使用 PIVOT 时获取 Null 数据)
问题描述
我在 PIVOT 中使用以下查询:
I am using the following query with PIVOT:
此查询为['我的主要兴趣']、旅行、住宿、奖品抽奖"列返回 Null,我不明白为什么,因为该表包含每条记录的这些列的数据..
This query returns Null for "['My main interests'], traveling,accommodation, prizedraw" columns, i am not getting why, as the table has data for these columns for each record..
请帮助我如何获取数据.
Please help me how can I get data.
更新 ::
推荐答案
我想这会对你有所帮助.我们应该为空格列使用 QuoteName 函数.
I think this will help you.we should use QuoteName function for space column.
这篇关于在 sql server 2008 R2 中使用 PIVOT 时获取 Null 数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!