Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Use of LIKE and Wildcards in SOQL queries
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Use of LIKE and Wildcards in SOQL queries
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-07-2009 09:07 AM
public List<Lead> getleadz(){ Lead ld = [Select id, email FROM Lead where id = :lead.id]; String EmailSubstring = ld.email.substring(ld.email.indexOf('@',0)); leadz = [Select id, Name, company, status, email, phone from Lead where email like :EmailSubstring];
return leadz; }
Unfortunately, the SOQL query that defines "leadz" returns 0 lines, even though I know that there are other leads with similar email addresses. I'm probably missing a wildcard, but whenever I put a wildcard next to ":EmailSubstring" in my SOQL query, I get a save error as my syntax is all wrong.
Does anybody know where I'm going wrong?
With thanks,
Andy
Solved! Go to Solution.
Re: Use of LIKE and Wildcards in SOQL queries
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-07-2009 09:26 AM
Re: Use of LIKE and Wildcards in SOQL queries
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
07-08-2009 01:24 AM
Simon,
You're something like a genius, thanks!
Andy

