Check out SUBSTRING in the manual.

On the zip codes, you're better off not trying to do any
comparisons in SQL -- the way they work is extremely
complicated.  I would suggest that you purchase distance
measurements between two arbitrary zip codes from the
Postal Service, if you intend to be accurate.

-Tilghman

-- 
"There cannot be a crisis today.  My schedule is already full."
     --Henry Kissinger

> -----Original Message-----
> From: Cindy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 07, 2001 13:33
> To: [EMAIL PROTECTED]
> Subject: slicing strings for comparison?
> 
> 
> 
> I have a select I'd like to do...I have 2 kinds of people -- those
> needing interviews, and those doing interviews.  Among other things,
> each person has their home address/phone in the tables.  I want to
> generate lists of interviewers in close geographical proximity to the
> interviewees.  I can do the city check easily of course, but I'm
> stumped on telephone exchanges and zipcode matches.
> 
> The telephone numbers are stored as char[12] (three digits, dash,
> three digits, dash, four digits).  I want to compare the second
> set of three digits to each other, something like
> 
>   WHERE Interviewee.homephone[4-6] = Interviewer.homephone[4-6]
> 
> Similarly for zip codes, I want to compare the first three characters
> of a char[10] (zip plus 4], essentially
> 
>   WHERE Interviewee.zip[0-2] = Interviewer.zip[0-2]
> 
> Are these types of comparisons possible?  If so, what's the syntax?  I
> couldn't find anything in the online documentation, though it's
> possibly not called "slicing" or "string range"...
> 
> --Cindy
> -- 
> [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to