On Sun, Dec 07, 2003 at 12:11:21AM -0500, Alex Khordos wrote: > > I am trying to work out the query to retrieve city name based on the zip > code in the second table. > How can I compare two strings? I tried LIKE in my query but it did not work.
Use SUBSTRING to cut down the extended zipcode to 5 characters, then you can use a standard = comparison: WHERE (SUBSTRING(table2.zip_code,0,5) = table1.zip_code) -- Chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]