[thelist] SQL Query

Dougal Campbell dougal at gunters.org
Mon Aug 18 12:37:25 CDT 2003


On Mon, 18 Aug 2003, Stevenson N wrote:

> Hi all,
>
> If i have  values 2.12.12 and 2.13.13.3
>  How can i differentiate in SQL the value that has two dots i.e
> 2.12.12 from the value that has three dot i.e 2.13.13.3

Select just the three-dot values:

  SELECT * from mytable WHERE myfield LIKE "%.%.%.%"

Select just the two-dot values:

  SELECT * from mytable WHERE myfield LIKE "%.%.%"
    AND NOT myfield LIKE "%.%.%.%"

-- 
Ernest MacDougal Campbell III, MCP+I, MCSE <dougal at gunters.org>
http://dougal.gunters.org/             http://spam.gunters.org/
  Web Design & Development:  http://www.mentalcollective.com/
       This message is guaranteed to be 100% eror frea!


More information about the thelist mailing list