|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
||||
|
||||
|
RE: get first 2 chararacters
Hey cheryl - you didn't trust that other forum huh? Well, you picked wisely, these 2 are the best.
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > get first 2 chararacters |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|