September 29, 2005 at 9:12 am
I tried replying to the original post, but no matter how many times I clicked on Post Reply, nothing happend!!
No, as far as I know there is nothing in SQL syntax that will allow you to use field values as field names. What you are asking still falls under report layout design category. SQL will give you the resultset in a tabular format. You then will use a front-end report designer to format a layout of your need using resultset values. You must use a front-end report designer and have SQL supply you the back-end data.
September 29, 2005 at 2:00 pm
weird, i have the same problem JN...
OP:
You could create a table (a temp one if you like), that "looks" like the final report you want. i.e.:
CREATE TABLE #ret
(
Company CHAR(15),
Red20050901 INT,
Black20050901 INT,
Red20050902 INT,
...
)
and put in a row for each Company.
INSERT INTO #ret (Company)
SELECT DISINCT Company
FROM OriginalDataTable
Then populate the rest with a bunch of queries on the data you have, i.e.:
UPDATE r
SET Red20050901 = t.Total
FROM #ret r
INNER JOIN (
SELECT Company,
SUM(Count)
FROM OriginalDataTable
WHERE Color = 'Red'
AND StatusDate = '2005-09-01'
GROUP BY Company
) t
ON t.Company = r.Company
-- Stephen Cook
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply