PDA

View Full Version : Selecting all records that....


boomers
26-04-2007, 08:02 PM
Hi

I have a large table with allot of data in it, Im trying to find the correct SQL statement to select all the records that do not start with a letter or a number.

So some records may start with a '~' and a few '$' and even some '?'. So I would like a statement that would select all of these while leaving out any records that start with anything else, such as numbers or letters.

And on a similar theme, Im also trying to select all records that start with a number.

Ive been using the "select blah from blah where LIKE 'a%'" for each letter and ive tried to have a play and search around that statement, but still not found an answer.

Would appreciate any help on the matter :)

Ben Collier
26-04-2007, 10:43 PM
You've probably already looked but:
http://www.w3schools.com/sql/default.asp

Often is useful for this kinda thing!

Ben

Paul Humphris
10-05-2007, 10:51 AM
You were along the right lines by using the LIKE command. Try this:

select * from table where field like '[^a-z]%' and like '[^0-9]%'

This should return all records that do not start with A-Z or 0-9.

Hope it helps.