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.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Searchng a Text Field with Wildcards

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-16-05, 22:03
johneliot johneliot is offline
Registered User
 
Join Date: Nov 2005
Posts: 5
Searchng a Text Field with Wildcards

Hi,

Can anyone see what im doing wrong here..

SELECT *
FROM OutOfPrintItemsTable
WHERE OutOfPrintItemsTable.Title Like "*" & S12006ReferencesTable.Reference & "*";


Im trying to search all the Title Fields Text Fields in the OutOfPrintItemsTable where there is a partial match in the S12006ReferencesTable Reference Text Field.

So if the Out of print title field was for example "Happy Days"

Then when performing the Search in the S12006ReferencesTable there would be a match if the References field was "sdfSome Bolix Happy Days some ore bloixdlf"

I think the logic is right i just cant get the syntax right, or perhaps its all wrong

Any help would be most valuable.
Kind Regards,
John Eliot
Reply With Quote
  #2 (permalink)  
Old 11-17-05, 02:21
ivon ivon is offline
Registered User
 
Join Date: Nov 2002
Posts: 272
You've got the Like operation backwards. In your explanation, the title must be part of the reference, and in your SQL, the reference must be part of the title:

Where 'Happy Days' Like '*sdfSome Bolix Happy Days some ore bloixdlf*'

will not return the record.

The other way round,

Where 'sdfSome Bolix Happy Days some ore bloixdlf' Like '*Happy Days*'

will.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On