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 |
sal_ster
Starting Member
1 Post |
Posted - 2008-03-26 : 09:06:38
|
I'm trying to join two tables with LIKE and a wildcard but am not sure if you can use wilcards on fields (as opposed to strings). EG. TABLE1.COLUMN1 has 1 record of vlaue XXXTABLE2.COLUMN2 has 3 records of value XXX% (ie. XXX1, XXX2, XXX3)I want to join the two tables by the above.Simple data query works fine:select * from TABLE2where COLUMN2 like 'XXX%'but how do I achieve the same by using the field name from the other table (rather than specific string) and how do I continue to use the wldcard with the field name? Do I need to do another select statement within the statement?? select * TABLE1, TABLE2where TABLE2.COLUMN2 like TABLE1.COLUMN1% |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-26 : 09:08:52
|
SELECT * FROM Table1 AS t1INNER JOIN Table2 AS t2 ON t2.Column2 LIKE t1.Column1 + '%' E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|