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 |
niranjankumark
Posting Yak Master
164 Posts |
Posted - 2008-01-26 : 04:13:32
|
my 2 table has datatable1========001002003004005006007table2========00010020030004005008need output as===============001 0001004 0004note : 002, 003 are same but not need. differes in zero alone. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-26 : 04:31:11
|
what is the relationship between table1 and table2 ?How do you relate Table1's 001 to Table2's 0001 and 004 to 0004 ?How about 006 and 007 of Table1 and What happen to 008 of table2 ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
niranjankumark
Posting Yak Master
164 Posts |
Posted - 2008-01-26 : 04:40:00
|
Consider starting value is zero. in both table columni shud remove zero only if it differs,ex : 001 & 0001filter the zero in this condition and match.But supposeex : 002 & 002 i shud not filter zero.becouse zero count are same. it is not required.Key point is filter zero if it deiiffer, if other valu differ mean not required like 008. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-01-26 : 11:12:51
|
Try:-SELECT t1.Col as Col1,t2.Col as Col2FROM table1 t1INNER JOIN table2 t2ON t2.Col<>t1.ColAND RIGHT(t2.Col,LEN(t1.Col))=t1.Col |
 |
|
|
|
|