select statement that will retrieve all entries that have a certian letter combination in it?
-
Hi. I am trying to figure out how to write a select statement that will retrieve all entries that have a certian letter combination in. EG: If the user enters "a" it will retrieve all words starting with an "a". if he enters "ad" it will return all words stsrting with "ad" etc. Please advise
-
Hi. I am trying to figure out how to write a select statement that will retrieve all entries that have a certian letter combination in. EG: If the user enters "a" it will retrieve all words starting with an "a". if he enters "ad" it will return all words stsrting with "ad" etc. Please advise
This is a very basic SQL question. I suggest picking up a beginners book on SQL Server and working through it. All you have to do is add a WHERE clause using the LIKE operator:
SELECT _field1, field2, fieldn, ..._ FROM _table_ **WHERE _somefield_ LIKE 'ab%'**
This will return all entries starting with the letters "ab" in some field you chose.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
This is a very basic SQL question. I suggest picking up a beginners book on SQL Server and working through it. All you have to do is add a WHERE clause using the LIKE operator:
SELECT _field1, field2, fieldn, ..._ FROM _table_ **WHERE _somefield_ LIKE 'ab%'**
This will return all entries starting with the letters "ab" in some field you chose.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007