Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old April 15th, 2003, 05:49 PM
cherylw cherylw is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Dougalsville, GA USA
Posts: 10 cherylw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to cherylw
get first 2 chararacters

Hello,
I need to compare the first 2 characters of two fileds and match the busPhone number. Each of this will be compared aganist new Vars.

here's what I have:

$sql_result2 = mysql_query("SELECT fName,lName,busPhone
FROM members WHERE lName LIKE '$new_lname [2]*' AND fname LIKE '$new_fname [2]*' AND busPhone ='$new_busPhone';");


I looked at http://www.mysql.com/doc/en/Pattern_matching.html for help, but I just don't get it.

please help me - thanks
~cherylw

Reply With Quote
  #2  
Old April 16th, 2003, 06:52 AM
hh hh is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Aalborg, Denmark
Posts: 36 hh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to hh
RE: get first 2 chararacters

Use substring instead:

select * from table where SUBSTRING(field, 1, 2) = '12'

this returs values where field contains 12 in the beginning.

Reply With Quote
  #3  
Old April 16th, 2003, 09:22 AM
sarah's Avatar
sarah sarah is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Auckland, New Zealand
Posts: 127 sarah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 32 sec
Reputation Power: 2
Send a message via ICQ to sarah Send a message via AIM to sarah Send a message via Google Talk to sarah
RE: get first 2 chararacters

Hey cheryl - you didn't trust that other forum huh? Well, you picked wisely, these 2 are the best.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > get first 2 chararacters


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT