Re: [PHP] mysql - SUBSTRING

2001-05-13 Thread Nuno Silva


hello,

i would try this:

SELECT SUBSTRING(field,pos,len) AS mystring, id, blah FROM mytable WHERE 
mystring LIKE '%ABC%';

regards,
Nuno Silva


andreas (@work) wrote:

 hi,
 
 if i use SUBSTRING(field,pos,len) in a SELECT statement it works fine
 
 but i cant work it out how to use this function in the WHERE clause 
 
  ... WHERE  SUBSTRING(field,pos,len) LIKE ABC
  ... WHERE SUBSTRING(field,pos,len) = 'ABC'
  ... WHERE SUBSTRING(field,pos,len) LIKE 'ABC'
 
 none of them work
 
 is this not possible or whats wrong ?
 
 
 thank you
 
 andreas
 
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql - SUBSTRING

2001-05-12 Thread andreas \(@work\)

hi,

if i use SUBSTRING(field,pos,len) in a SELECT statement it works fine

but i cant work it out how to use this function in the WHERE clause 

 ... WHERE  SUBSTRING(field,pos,len) LIKE ABC
 ... WHERE SUBSTRING(field,pos,len) = 'ABC'
 ... WHERE SUBSTRING(field,pos,len) LIKE 'ABC'

none of them work

is this not possible or whats wrong ?


thank you

andreas




Re: [PHP] mysql - SUBSTRING

2001-05-12 Thread CC Zona

In article 000c01c0dabb$422d2bd0$0101@devel01,
 [EMAIL PROTECTED] (andreas \(@work\)) wrote:

 but i cant work it out how to use this function in the WHERE clause 
 
  ... WHERE  SUBSTRING(field,pos,len) LIKE ABC
  ... WHERE SUBSTRING(field,pos,len) = 'ABC'
  ... WHERE SUBSTRING(field,pos,len) LIKE 'ABC'
 
 none of them work

Hard to say what's wrong without actual an actual query to look at, nor 
info on what error (if any) MySQL is reporting.  Though perhaps as a point 
of reference, do note that use of the like keyword should usually be 
accompanied by a wildcard character, usually the %:

like ABC%
like %ABC
like %ABC%
etc.

IOW, LIKE without wildcards is the same as using the = comparison 
operator.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]