If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Select stmt using Like
I have 2 tables in an db. Contacts is one with field LastName. The other is
Issues. The issues db has a free text field that stores lastname/lastname... the field is called Owner. The objective is for multiple owners in an issue, but not necessarily from the Contacts table. I am trying to write a select statement that will allow me to compare the Contacts.LastName with any Issues.Owner. Select * From Issues Where Issues.Owner LIKE *[Contacts.lastname]* (except I cannot use this format) Any ideas would be appreciated. -- dan |
#2
|
|||
|
|||
Select stmt using Like
You can use a non-equi-join query (though it'll be slow with large amounts
of data): Select * From Issues INNER JOIN Contacts ON Issues.Owner LIKE "*[Contacts.lastname]*"; -- Ken Snell http://www.accessmvp.com/KDSnell/ "dpm1028" wrote in message ... I have 2 tables in an db. Contacts is one with field LastName. The other is Issues. The issues db has a free text field that stores lastname/lastname... the field is called Owner. The objective is for multiple owners in an issue, but not necessarily from the Contacts table. I am trying to write a select statement that will allow me to compare the Contacts.LastName with any Issues.Owner. Select * From Issues Where Issues.Owner LIKE *[Contacts.lastname]* (except I cannot use this format) Any ideas would be appreciated. -- dan |
#3
|
|||
|
|||
Select stmt using Like
On Mon, 10 May 2010 17:54:01 -0700, dpm1028
wrote: I have 2 tables in an db. Contacts is one with field LastName. The other is Issues. The issues db has a free text field that stores lastname/lastname... the field is called Owner. The objective is for multiple owners in an issue, but not necessarily from the Contacts table. I am trying to write a select statement that will allow me to compare the Contacts.LastName with any Issues.Owner. Try Select Issues.* From Issues INNER JOIN Contacts ON Issues.Owner LIKE "*" & [Contacts].[lastname] & "*" This will give undesired results if there are LastName values such as "Wu" or "Lo" or "Lee", since those text strings could appear in other parts of the freeform text. -- John W. Vinson [MVP] |
#4
|
|||
|
|||
Select stmt using Like
Would it not be like this --
Select * From Issues INNER JOIN Contacts ON Issues.Owner LIKE "*" & [Contacts.lastname] & "*"; -- Build a little, test a little. "Ken Snell" wrote: You can use a non-equi-join query (though it'll be slow with large amounts of data): Select * From Issues INNER JOIN Contacts ON Issues.Owner LIKE "*[Contacts.lastname]*"; -- Ken Snell http://www.accessmvp.com/KDSnell/ "dpm1028" wrote in message ... I have 2 tables in an db. Contacts is one with field LastName. The other is Issues. The issues db has a free text field that stores lastname/lastname... the field is called Owner. The objective is for multiple owners in an issue, but not necessarily from the Contacts table. I am trying to write a select statement that will allow me to compare the Contacts.LastName with any Issues.Owner. Select * From Issues Where Issues.Owner LIKE *[Contacts.lastname]* (except I cannot use this format) Any ideas would be appreciated. -- dan . |
#5
|
|||
|
|||
Select stmt using Like
Yes, thanks for the catch, Karl.
-- Ken Snell http://www.accessmvp.com/KDSnell/ "KARL DEWEY" wrote in message ... Would it not be like this -- Select * From Issues INNER JOIN Contacts ON Issues.Owner LIKE "*" & [Contacts.lastname] & "*"; -- Build a little, test a little. "Ken Snell" wrote: You can use a non-equi-join query (though it'll be slow with large amounts of data): Select * From Issues INNER JOIN Contacts ON Issues.Owner LIKE "*[Contacts.lastname]*"; -- Ken Snell http://www.accessmvp.com/KDSnell/ "dpm1028" wrote in message ... I have 2 tables in an db. Contacts is one with field LastName. The other is Issues. The issues db has a free text field that stores lastname/lastname... the field is called Owner. The objective is for multiple owners in an issue, but not necessarily from the Contacts table. I am trying to write a select statement that will allow me to compare the Contacts.LastName with any Issues.Owner. Select * From Issues Where Issues.Owner LIKE *[Contacts.lastname]* (except I cannot use this format) Any ideas would be appreciated. -- dan . |
Thread Tools | |
Display Modes | |
|
|