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 |
|
jstrockbine
Starting Member
4 Posts |
Posted - 2007-12-05 : 09:58:33
|
| Here is the query I'm using: select ul.userID as ulID, ul.gameID, ul.consoleID, ul.gamemanual, ul.gamedesc, ul.gamecond, ur.userId as urID from userlibraryGame ul inner join userrequestsGame ur on ul.gameID = ur.gameIDWhat I want to accomplish is this: I want to inner joing ul.gameId on ur.gameID but I want to use "like" instead of equals. Basically, I want to look for approximate matches and return the results instead of exact matches. But I dont know how to accomplish this when using "like" on 2 column names? any thoughts? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-05 : 10:04:17
|
Also explain "approximate". What are criterias to be "approximate"? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2007-12-05 : 10:06:39
|
| your join between the tables doesn't have to be a straight '=' you can use like, <, >, case etc... if you can't figure it out give some examples of the data you want to compare and expected results etcEm |
 |
|
|
jstrockbine
Starting Member
4 Posts |
Posted - 2007-12-05 : 10:06:44
|
| just matches that would be returned if I used "...like '%somedata%'"basically containing most of the characters in the field. |
 |
|
|
jstrockbine
Starting Member
4 Posts |
Posted - 2007-12-05 : 10:24:51
|
| to clarify abit, I'm wanting to specify the field to be joined on as the LIKE paramenter as such: field1 LIKE '%FIELD2%' without the characters "FIELD2" being taken literally and matched on "FIELD2". See what I mean? |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2007-12-05 : 10:27:29
|
| as in... like '%' + field2 + '%'Em |
 |
|
|
jstrockbine
Starting Member
4 Posts |
Posted - 2007-12-05 : 10:48:02
|
| Yes, Em, exactly what I needed. Thank you. |
 |
|
|
|
|
|
|
|