Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to display data from two tables in which display all data from first table and one one filed from second table so which query i will use... and there is no common field
Plz Reply
Posted
Updated 27-Apr-12 20:33pm
v3
Comments
OriginalGriff 28-Apr-12 3:03am    
If there is no common field, how do you expect us to be able to help you write a query?
We have no idea what your data looks like, or what results you expect to get.
Try giving us an example of your data inputs, and what you want as data output. Then we may be able to help.
Use the "Improve question" widget to edit your question and provide better information.

Simplest way is: use hash table

1> Create hash table with requred field
2> Insert data from first table to this hash table.
3> Then using while loop, update this hash table with column from second table.
4> Finaly select from hash table.
 
Share this answer
 
Unless there is some commonality between the data tables then this will not work and does not make sense, you are better off showing two tables one after another.

If there is commonalty you can use :
SQL
select c1 as 'x',c2 as 'y' from table1
union 
select d1 as 'x', d2 as 'y' from table2

where c1, c2 are the column names from table1 and d1 and d2 from table2, 'x' and 'y' is the name for the columns in your query.
 
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