是否可以使SQL Server转换一组结果中的条目列

时间:2009-12-01 21:45:02

标签: sql sql-server-2000

我有以下设置......

Table: properties
p_id [pk]
p_propname
o_id_owners [fk]

Table: owners
o_id [pk]
o_extcode
o_fname
o_lname

Table: selectedfeatures
s_id [pk]
d_id_features [fk]
p_id_properties [fk]

Table: features
d_id [pk]
d_code
d_featurename
g_id_featuregroup [fk]

Table: featuregroup
g_id [pk]
g_featuregroupname

理想情况下,我希望它输出

<header> Owner name | Owner Extcode | Prop name | [GROUP NAMES (featuregroup)] 
<row> Owner name | Owner Extcode | Prop name | ^feature code | ^feature code | 

它的小组名称我正在努力;这些表是链接的,因此可以显示记录:

<header> Owner name | Owner Extcode | Prop name | Feature Name
<row> Owner name | Owner Extcode | Prop name | Feature Name
<row> Owner name | Owner Extcode | Prop name | Feature Name

1 个答案:

答案 0 :(得分:3)

你看到了这个吗? Five methods converting rows to columns