From: Martijn Tonies Date: December 4 2003 5:22pm Subject: Re: WHERE with CASE colums? List-Archive: http://lists.mysql.com/mysql/155066 Message-Id: <003301c3ba8b$34e32df0$0e02a8c0@martijn> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi Scott, === When searching and listing them I want to remove any preceeding 'The ', 'An ', or 'A ' that occurs in the title and I also want to be able to search it. The case statement as follows seems to work fine: SELECT CASE WHEN title LIKE 'The %' THEN RIGHT( title, length( title ) -4 ) WHEN title LIKE 'A %' THEN RIGHT( title, length( title ) -2 ) WHEN title LIKE 'An %' THEN RIGHT( title, length( title ) -3 ) ELSE title END AS modtitle FROM Journal_Info But if I try a WHERE clause using the columns AS title I get an error. Can anyone help me figure out how to search the CASEed column? == Are you trying: WHERE modtitle = '... something ... ' ? Cause the WHERE clause only works on columns. If you want to do a match on the result of the CASE, you have to do your case thingy again: WHERE ( case ...yourstuff... end ) = 'something' With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL Server. Upscene Productions http://www.upscene.com