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 |
KabirPatel
Yak Posting Veteran
54 Posts |
Posted - 2007-07-04 : 14:20:31
|
Hi,I have data as follows:create table t(col1 varchar(255))insert into tselect 'bob'create table t1(col1 varchar(255))insert into t1select 'bob' unionselect 'bob1' unionselect 'bob2' unionselect 'sdfsdf' I would like to see all values in t that matches the values in t1 with a wildcard. i.e. I wuold like to see the following:t.col1 t1.col1--------------------------bob bobbob bob1bob bob2I have tried the following but it doesnt work:select * from t inner join t1 ont.col1 like t1.col1Thanks,Kabir |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-04 : 14:31:55
|
select * from t inner join t1 ont.col1 like t1.col1 + '%'Peter LarssonHelsingborg, Sweden |
 |
|
KabirPatel
Yak Posting Veteran
54 Posts |
Posted - 2007-07-05 : 04:59:44
|
That doesn't work. I only get:bob boband not recordsbob bob1bob bob2 |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-05 : 05:06:29
|
[code]SELECT * FROM t INNER JOIN t1 ON t1.col1 LIKE t.col1 + '%'[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|