Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Experts,

I have two tables:
1. Release_Master Table:
col1                        col2                                            col3.
 A                            B                                               C
 D                            E                                               F


2. Knowissues_master Table:
col5           col6             col7                                      col8.
 124            87              44                                         66
 33             gh              dd                                          44



I want to display col3 values of Release_Master and col8 values of Knowissues_master into the single column in the gridview

something like this:
Combined_column
C
F
66
44


How can I achieve this from code behind (C#) or how can I do this from sql server in the select statement.

Please help me out with this issue..i will appreciate you.
Posted
Updated 20-Sep-13 8:42am
v4
Comments
JoCodes 20-Sep-13 14:25pm    
Do you have any common column in both the table?
argeraju 21-Sep-13 7:51am    
No I don't have common column
argeraju 21-Sep-13 8:09am    
I don't have common columns . If it is , how can we display two different columns values of different tables into separate row into the single column?

 Hi  ,

I have solved that issue myself by using the table variables in the sql server.
The following code will give the same result what I expected.

DECLARE @table1 TABLE  (id int, name varchar(10))
INSERT INTO @table1 VALUES (1, 'issue1')
INSERT INTO @table1 VALUES (2,'issue2')
DECLARE @table2 TABLE (id int, name varchar(10), name2 varchar(10))
INSERT INTO @table2 VALUES (1, 'issue3','OneT')
INSERT INTO @table2 VALUES (2,'issue4','TwoT')
DECLARE @table3 TABLE (result nvarchar(max))


INSERT INTO @table3
SELECT name from @table1
UNION SELECT name from @table2
SELECT * FROM @table3
 
Share this answer
 
v2
Comments
Volynsky Alex 22-Sep-13 16:49pm    
5+
Assuming the data source has both the fields, you can use template fields

link[^]

If this is not what you are looking for:

Are you saying you have 2 data sources from which you wish to do the same? Post some code, it will be much more clearer.

PS: Sorry if this does not help
 
Share this answer
 
v2
Comments
argeraju 21-Sep-13 7:50am    
Hi karthik,

Actually i don't want to display the both column values into single column of same row.

I want to display them into single column in the separate row for every column value of those tables

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900