Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to fetching data from two different tables with different columns without foreign key and show these two table data in single grid view .any body have an idea about this if yes please give me solution for this....
Posted
Comments
Suvendu Shekhar Giri 7-Aug-15 1:41am    
Which database?
Can you share-
1. table structure of those 2 tables
2. 2-3 sample records for each table
3. Expected sample result
?

check DEMO[^] you can join using row number.
 
Share this answer
 
For this to work you must:

1) Ensure the data types of the two tables match or you CAST() them appropriately.
2) You can use UNION ALL and rename the columns to something that matches the two tables

SQL
select col1 as [ColA], col2 as [ColB] from table1
union all
select col3 as [ColA], col16 as [ColB] from table2
 
Share this answer
 
select col1,col2,col3 from table_name1 joins like inner join,left join,right join
select col1,col2,col3 from table_name2
 
Share this answer
 

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