Re: cross tab query > I have seen that most cross-tab queries examples assume numerical data
> and are based around using SUM and the GROUP BY phrase. But our data
> is a mixture of string and numbers (of various formats) and so GROUP
> BY is not an obvious solution. I have tried using CASE in the select
> list but this returns one row for each property with one column having
> the correct value, and all the other colums are NULL. I cannot think
> of how to combine these into one full record!!
Hi Bill,
Put your table into a hashish table, implement the IUnpronounceable
interface to convert it to XML, overload it with a semi-private method
name foo, call it from another method with a meaningless name that is
also a swear word, drag and drop into the trash can (sorry I meant
recycle bin), and do start->run->format c:. Seriously, I think this
might give you an idea.
SELECT
itemID,
name=MAX(case when propertyID='name' then value else null end),
color=MAX(case when propertyID='color' then value else null end),
size=MAX(case when propertyID='size' then value else null end)
FROM Property
GROUP BY itemID |