Returning a list of columns values

Posts   
 
    
Jed
User
Posts: 38
Joined: 08-Oct-2010
# Posted on: 17-Jan-2011 16:06:56   

Hello

I have a class

public class InvoiceClass { public guid id public string services }

My linq statement has a left join

My db tables are

Table Invoice Id Name

Table InvoiceLine Id Name Service

Now say there are 5 invoicelines for one invoice I need to populate the services string with the InvoiceLine service column value. This must be done in the sql query

For example the class values will be

Id = INV1002 Services = Prod1 , Prod2 , Prod3

Hope this make sense. Thanks in advance

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 18-Jan-2011 08:03:02   

This must be done in the sql query

For example the class values will be

Id = INV1002 Services = Prod1 , Prod2 , Prod3

I don't know how this can be done in plain SQL, could you please post the SQL code you want to produce?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 18-Jan-2011 09:17:21   

You can only do this with a custom aggregate function in SQL or you can do it in-memory. I'd do it in memory as a linq to objects query over the linq query executed on the db.

Frans Bouma | Lead developer LLBLGen Pro