I am wondering if it is possible to take the query results and return them as a CSV row instead of a cell column.
Basically, we have a Customer table, and we have a CustomerTypeLines table, and each Customer can have several CustomerTypeLines. When I run a query against it, I have problems when I want to check several types, for example:
Select * from Customers a Inner Join CustomerTypeLines b on a.CustomerID = b.CustomerID where b.CustomerTypeID = 14 and b.CustomerTypeID = 66
... returns nothing, because the client cannot have both on the same line, obviously.
To make it work, I had to add a CustomerTypes field for customers that looks like ,14,66,67, so I can do Where a.CustomerTypes like '%,14,%' and a.CustomerTypes like '%,66,%' , which returns 85 rows.
Of course, this is a pain, because I have to force my program to rebuild this field for this Client each time the CustomerTypeLines table is changed.
It would be nice if I could make a sub-query in my place where it would work for me, so instead of returning results, for example:
14 66 67
he will return them, like ,14,66,67,
Is it possible?