Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Dhanalakshmi
Starting Member
12 Posts |
Posted - 2011-09-21 : 06:53:20
|
| Hi,How to interrelate two tables or two select statement results?Table1:jobid isduplicate duplicateof324773362 1 324773379324773365 0 0324773366 1 324773371324773367 1 324773368324773368 0 0324773369 1 324773368324773370 0 0324773371 1 324773365324773379 0 0324773380 0 0324773398 0 0Table2:jobid IsDuplicate IsADuplicateOf324773362 0 0324773365 0 0324773366 0 0324773367 0 0324773368 0 0324773369 0 0324773370 0 0324773371 0 0324773379 0 0324773380 1 324773379324773398 1 324773368The result table like,jobid isduplicate duplicateof324773362 1 324773379324773365 0 0324773366 1 324773371324773367 1 324773368324773368 0 0324773369 1 324773368324773370 0 0324773371 1 324773365324773379 0 0324773380 1 324773379324773398 1 324773368Can you please help me?Thanks,DIP |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-21 : 07:11:45
|
| [code]select jobid,max(isduplicate),max(duplicateof)from(select jobid, isduplicate, duplicateoffrom table1union allselect jobid, isduplicate, duplicateoffrom table1)tgroup by jobid[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Dhanalakshmi
Starting Member
12 Posts |
Posted - 2011-09-22 : 05:17:44
|
| Hi,It is working fine.Thanks for your response.Thanks,DIP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-22 : 12:13:14
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|