SQL Syntax

shamas21

Registered User.
Local time
Today, 19:35
Joined
May 27, 2008
Messages
162
Hi All

Can some tell me what im doing wrong. Im trying to bring back Any field that begin with A or B using the IN Statement.

Thanks

SELECT country, name, amount
FROM tblcountries
WHERE Name IN ('A*','B*'));
 
shamas,

WHERE Name IN ('A*','B*'));

The items in the In clause can't contain wildcards. There is no like
operator.

Where Name Like 'A*' Or Name Like 'B*'

Also, Name is a reserved word.

hth,
Wayne
 
shamas,

Alternatively:

WHERE Left(Name, 1) IN ('A', 'B'));

Wayne
 
It looks like you also have an extra ")" (see below)

WHERE Left(Name, 1) IN ('A', 'B'))
 
Thanks Rookie,

It happens ...

Should Cut-And-Paste be illegal?

Wayne
 

Users who are viewing this thread

Back
Top Bottom