Forum Index Search Forum Register Log in

Runs on XP to Win 10

Current

Download 7.0

Download 7.1 Beta5 upgrade



A donation makes a contribution towards the time and effort that's going in to running this site.

Steffen

Contact:
My mail address is
at the top of the paypal form :

Your donations will help to keep this site alive and well.


Update your links !! November 2016 the forum is at www.apachelounge.com/sambar

In the forum there are links to sambarserver.info,
replace "sambarserver.info" with "apachelounge.com/sambar"
Use of LIKE in SQL

 
Post new topic   Reply to topic    Sambar Forum Index -> Coding & Script Corner
View previous topic :: View next topic  
Author Message
geoffcarter



Joined: 29 Jan 2005
Posts: 4
Location: UK

PostPosted: Fri 25 Aug '06 17:15    Post subject: Use of LIKE in SQL Reply with quote

I am doing a small project that involves running queries through the server to a small MS-Access database. All SQL statements run well until I try and use the 'LIKE' statement.
The statement I am using is:
SELECT URL, Text, Source, Date, Title FROM Headlines WHERE Area = 'RC$Area' AND Text LIKE '*test*'.

If I remove the part after RC$Area all works fine. I can even replace 'Area = " with 'Area LIKE ' and it still works but when I try and run the LIKE statement on a different field nothing is returned. However, if I run the SQL within Access it works fine.

It is probably something simple and obvious - which is why I can't see it By the way - both the fields referred to above are Text fields.
Back to top
View user's profile Visit poster's website
rgibson



Joined: 20 Oct 2009
Posts: 26

PostPosted: Mon 30 Nov '09 1:26    Post subject: Re: Use of LIKE in SQL Reply with quote

Use % instead of * for multi char matching or _ for single char matching

Randy

geoffcarter wrote:
I am doing a small project that involves running queries through the server to a small MS-Access database. All SQL statements run well until I try and use the 'LIKE' statement.
The statement I am using is:
SELECT URL, Text, Source, Date, Title FROM Headlines WHERE Area = 'RC$Area' AND Text LIKE '*test*'.

If I remove the part after RC$Area all works fine. I can even replace 'Area = " with 'Area LIKE ' and it still works but when I try and run the LIKE statement on a different field nothing is returned. However, if I run the SQL within Access it works fine.

It is probably something simple and obvious - which is why I can't see it By the way - both the fields referred to above are Text fields.
Back to top
View user's profile

Post new topic   Reply to topic    Sambar Forum Index -> Coding & Script Corner
Page 1 of 1