Do you really have ItemName in the Order Detail table? In a properly
normalized design you would normally expect that to exist only in a Products
table and for the order details to look something like this:
CREATE TABLE OrderItems (order_no INTEGER REFERENCES Orders (order_no),
sku_code INTEGER REFERENCES Products (sku_code) ..., PRIMARY KEY (order_no,
sku_code))
To concatenate values into a string for your report is something that would
be better done client-side. Extract all the rows, then loop through them in
your code.
Alternatively, here are some references on producing crosstabs in SQL that
may help you, or Google the archives of the
microsoft.public.sqlserver.programming group for more examples.
http://www.aspfaq.com/2462
--
David Portas
SQL Server MVP
--