Hi All

I have three tables

TableA:
AccountID, OrderID
123 , 1

TableB:
AccountID, OrderID, DocID
123 , 1 , D1

TableC:
DocID, AppID
D1 , A1
D1 ,A2


Is it possible to join the three tables and return AppID as one string in the result set?
ie
I want to achieve the following result set:
AccountID, OrderID, DocID, AppID
123 , 1 , D1 ,A1A2

I have written the following, but I can't get it to work (I am getting sytax error on line select @AppID = ....)

Code:
select 
a.AccountID, 
a.OrderID,
b.DocID,
(select @AppID = @AppID + AppID from TableC c where c.DocID = b.DocID)

from 
TableA a,
TableB b,
where a.AccountID = @AccountNumber
and a.AccountID *= b.AccountID
and a.OrderID *= b.OrderID
Can someone please give me some advice how to resolve this problem?

Thanks in advance for your help