I have an order table: 'Orders'
a order details table: 'Order Details'
and a products table: 'Products'
For reasons best ignored, I want to produce a query which has columns:
Orders.OrderID, Products
which has results like:
10248, 'Queso Cabrales, Singaporean Hokkien Fried Mee, Mozzarella di
Giovanni'
10249, 'Tofu, Manjimup Dried Apples'
________
so for those who don't really know what I'm on about and haven't got
access to northwind, I want the second cell to contain the returned
column of a second query (but in text format)
could anyone suggest a way this could be done? am I entering the land
of cursors?
Many thanks,
NeilNAJH (neilonusenet@.yahoo.co.uk) writes:
Quote:
Originally Posted by
For reasons best ignored, I want to produce a query which has columns:
>
Orders.OrderID, Products
>
>
which has results like:
>
10248, 'Queso Cabrales, Singaporean Hokkien Fried Mee, Mozzarella di
Giovanni'
10249, 'Tofu, Manjimup Dried Apples'
>
________
so for those who don't really know what I'm on about and haven't got
access to northwind, I want the second cell to contain the returned
column of a second query (but in text format)
>
could anyone suggest a way this could be done? am I entering the land
of cursors?
If you are on SQL 2000, yes. SQL Server MVP Anith Sen covers the various
methods on http://www.projectdmx.com/tsql/rowconcatenate.aspx.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||
Quote:
Originally Posted by
Quote:
Originally Posted by
>For reasons best ignored, ... <<
Do not ignore the reasons; so, why do you want to write stinking bad
code?|||--CELKO-- wrote:
Quote:
Originally Posted by
Quote:
Originally Posted by
Quote:
Originally Posted by
>>For reasons best ignored, ... <<
>
Do not ignore the reasons; so, why do you want to write stinking bad
code?
At least he isn't talking about storing the data that way, merely
outputting it that way. That said, I would do it in a separate
reporting layer (e.g. Crystal Reports) if at all possible.|||On May 21, 3:27 am, Ed Murphy <emurph...@.socal.rr.comwrote:
Quote:
Originally Posted by
--CELKO-- wrote:
Quote:
Originally Posted by
Quote:
Originally Posted by
>For reasons best ignored, ... <<
>
Quote:
Originally Posted by
Do not ignore the reasons; so, why do you want to write stinking bad
code?
>
At least he isn't talking about storing the data that way, merely
outputting it that way. That said, I would do it in a separate
reporting layer (e.g. Crystal Reports) if at all possible.
I know it's bad practice to do it that way and a seperate reporting
layer like crystal reports etc would be lovely, but I'm in a situation
where I don't have those kind of facilities and budgets at my
disposal. It's just a means to an end. I'm certainly not holding data
like that. It's bad enough dealing with internal politics without
having to deal with it again on here! Thanks to you all for your kind
(or not so kind) input.
Neil
No comments:
Post a Comment