| Author |
Topic |
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2009-07-24 : 07:44:19
|
| Hi Friends,Is there possible to show two tables in a single query.If i have table A and Table B , i need to show the data of table A and Table B in a single select Query. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-24 : 07:46:38
|
[code]select *from tablea a inner join tableb b on a.pk = b.pk[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2009-07-24 : 07:52:28
|
quote: Originally posted by khtan
select *from tablea a inner join tableb b on a.pk = b.pk KH[spoiler]Time is always against us[/spoiler]
Hi Friend,Thanks For your Reply.But i didn't have a common field in both table. |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-07-24 : 08:51:40
|
| With out common fields you get Cartesian productselect * from temp2 , temp1Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-24 : 09:02:06
|
quote: Originally posted by Kotti
quote: Originally posted by khtan
select *from tablea a inner join tableb b on a.pk = b.pk KH[spoiler]Time is always against us[/spoiler]
Hi Friend,Thanks For your Reply.But i didn't have a common field in both table.
Post some sample data with expected resultMadhivananFailing to plan is Planning to fail |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-24 : 09:14:06
|
| HiCartesian product is mainly used combination of possible probability right-------------------------R.. |
 |
|
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2009-07-24 : 09:28:43
|
| Table A AId AName1. Kotti2. Prasad3. sam4. KumarTable BBId BName1. Karthi2. Nis3. Sugumar4. DhinaI need the output Like thisNameKottiPrasadsamKumarKarthiNisSugumarDhinaThanks |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-07-24 : 09:29:18
|
quote: Originally posted by rajdaksha HiCartesian product is mainly used combination of possible probability right-------------------------R..
Ya.. It make all the Combination. If both the table have 4 rows thenthe result will be 16.Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-07-24 : 09:31:15
|
quote: Originally posted by Kotti Table A AId AName1. Kotti2. Prasad3. sam4. KumarTable BBId BName1. Karthi2. Nis3. Sugumar4. DhinaI need the output Like thisNameKottiPrasadsamKumarKarthiNisSugumarDhinaThanks
Then you use union Select name from table1 unionSelect name from table2Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2009-07-24 : 10:35:53
|
quote: Originally posted by senthil_nagore
quote: Originally posted by Kotti Table A AId AName1. Kotti2. Prasad3. sam4. KumarTable BBId BName1. Karthi2. Nis3. Sugumar4. DhinaI need the output Like thisNameKottiPrasadsamKumarKarthiNisSugumarDhinaThanks
Then you use union Select name from table1 unionSelect name from table2Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
For sample data only i posted like that.Table A and B has some more fields.Table A 3 Fields and Table B 5 fields |
 |
|
|
|