Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incorrect syntax near ',' - What's wrong!? 1

Status
Not open for further replies.

xscape

Programmer
Apr 18, 2001
144
0
0
GB
Hi,

I've been going over and over this but can't see the syntax error. Here's the query:

SELECT * FROM Newsletter WHERE VisitorCountry='DZ','AS','AD' AND VisitorPhoneType='Alcatel BE3','Alcatel BE4','Alcatel BF3';

The error I keep getting is: Incorrect syntax near ','

Any ideas what is wrong with this query? It seems to work fine if I only use one value for VisitorPhoneType but goes wrong when I use more than one. I can use as many VisitorCountry values as I like wihtout problems though.#

Any ideas?

Thanks a lot - it's driving me mad!
 
SELECT * FROM Newsletter WHERE VisitorCountry IN ('DZ','AS','AD') AND VisitorPhoneType IN ('Alcatel BE3','Alcatel BE4','Alcatel BF3')



Thanks

J. Kusch
 
Looks like a good way of doing it - thanks! I sorted it about 10 seconds after posting using the syntax:

SELECT * FROM Newsletter WHERE (VisitorCountry='DZ' OR VisitorCountry='AS' OR VisitorCountry='AD') AND ( VisitorPhoneType='Alcatel BE3' OR VisitorPhoneType='Alcatel BE4' OR VisitorPhoneType='Alcatel BF3');

Bit more complicated than your option so I might use that instead!

Thanks for your input!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top