Click here to Skip to main content
14,644,614 members
Rate this:
Please Sign up or sign in to vote.
How to display three columns data from one table as single column ?

Select ACODE as ID, PARTY_NAME as [NAME] from Tblmst_Party left outer join TblTrn_Purch_Enquiry a on Tblmst_Party.ACODE = a.PARTY_CODE1 left outer join TblTrn_Purch_Enquiry b on b.PARTY_CODE2 = tblmst_Party.ACODE left outer join TblTrn_Purch_Enquiry c on c.PARTY_CODE3 = tblmst_Party.ACODE  where c.ENQNO =16


this is going wrong please suggest me any idea.
Posted
Updated 24-Aug-11 19:53pm
v2
Comments
walterhevedeich 25-Aug-11 1:54am
   
You simply concatenate the values, like this.

SELECT val1 + val2 + val3 as tblColumn from yourTable.
Rate this:
Please Sign up or sign in to vote.

Solution 1

Try this..

Select ACODE+PARTY_NAME as [ID and NAME] from Tblmst_Party left outer join TblTrn_Purch_Enquiry a on Tblmst_Party.ACODE = a.PARTY_CODE1 left outer join TblTrn_Purch_Enquiry b on b.PARTY_CODE2 = tblmst_Party.ACODE left outer join TblTrn_Purch_Enquiry c on c.PARTY_CODE3 = tblmst_Party.ACODE  where c.ENQNO =16
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

try to find out in the following way.

select Cast(ID as varchar(20))+Cast(ENQNO  as varchar(20))+PARTY_NAME as Name from YourTableName
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100