• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using 'Like' in 'sql' query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using 'Like' in 'sql' query


  • Subject: Re: Using 'Like' in 'sql' query
  • From: Alan Ward <email@hidden>
  • Date: Thu, 10 Apr 2003 20:50:39 -0700

I think you need '%' on the front and not '*'.

i.e. sqlQuery = "SELECT firstname FROM Person WHERE firstname like '%" + enteredFirstName + "%'";

Or to be more specific - that works with Oracle.

Alan

On Thursday, April 10, 2003, at 08:08  PM, Riaz Lalehzari wrote:

Hello,

I tried searching the archives for posts on using 'like' in 'sql' queries but the search engine says "ignored: like sql No matches." HAHA.
Basically, I already have used 'like' in my EOModeler fetch specifications with no problems. But now that I am using it in a variable sql string, it doesn't seem to work (ie. only returns exact matches). This is an example of what I do:


String sqlQuery;

sqlQuery = "SELECT firstname FROM Person WHERE firstname like '" + enteredFirstName + "'"

Then I say - results = EOUtilities.rawRowsForSQL(....);

I've tried manually coding the '*' wildcard and '?' on the ends of the string, inside and outside the ' symbols. If I enter "Ken*" as my enteredFirstName it still should work though. But it seems to be looking for people with the name "Ken*" instead of using a wildcard.


Regards,

Riaz





_________________________________________________________________
Hotmail now available on Australian mobile phones. Go to http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Using 'Like' in 'sql' query (From: "Riaz Lalehzari" <email@hidden>)

  • Prev by Date: Re: Using 'Like' in 'sql' query
  • Next by Date: WO5.1.3 and java1.4 on solaris
  • Previous by thread: Re: Using 'Like' in 'sql' query
  • Next by thread: WO5.1.3 and java1.4 on solaris
  • Index(es):
    • Date
    • Thread