SQL statement assistance

D

dksj67

I would like to create an Access query based on a text field with a result
set that would not include records where the text in that field starts with
the letter z or Z. How do I write an SQL WHERE statement that performs this
function?

Thanks,

Dan Kreiling
 
F

fredg

I would like to create an Access query based on a text field with a result
set that would not include records where the text in that field starts with
the letter z or Z. How do I write an SQL WHERE statement that performs this
function?

Thanks,

Dan Kreiling

Where YourTable.[Fieldname] Not Like "Z*"

or you could use:
Where Left(YourTable.[Fieldname],1) <> "Z"

Access is case insensitive, so "Z" and "z" are treated the same in
this instance.
 
M

Marshall Barton

dksj67 said:
I would like to create an Access query based on a text field with a result
set that would not include records where the text in that field starts with
the letter z or Z. How do I write an SQL WHERE statement that performs this
function?


SELECT *
FROM table
WHERE Left(textfield,1) <> "z"
 
J

John Spencer

WHERE SomeField LIKE "[!z]*" Or SomeField is Null

Alternative

WHERE SomeField NOT LIKE "z*" Or SomeField is Null


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top