Re: Select just the first two letters in a column (MySQL)

From: Date: Thu, 08 Mar 2001 19:13:31 +0000
Subject: Re: Select just the first two letters in a column (MySQL)
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7212@lists.php.net to get a copy of this message
On Thu, 8 Mar 2001 08:47:41 -0600, John Guynn wrote: >Is there a way to select just the first two letters in a column? I have a >column that contains values like TT1, TT2, TT3, TT4, PR1, PR2, RD1, RD2, >RD3, and I'd like to SELECT DISTINCT the first two letters. In otherwords >have the select statement return TT, PR, RD. SELECT LEFT(column) FROM table -- or -- SELECT SUBSTR(column, 1, 2) FROM table -- Rod Buchanan Programmer/Analyst/List Manager/JOATMON KDS Internet Services http://www.kdsi.net

« previous php.db (#7212) next »