Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 multiple IN operator for different column
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Mohamed Gani
Starting Member

2 Posts

Posted - 07/14/2013 :  06:49:30  Show Profile  Reply with Quote
I m trying to execute
SQL Query in Excel vba,
Below is a query
SELECT stu_id, stu_
name, stu_class
FROM stu_table
WHERE stu_name IN
stu_class IN ( 10,12)
But it doesn't work.
does it possible to use
multiple IN operator for
different column ?
Thanks in advance


Very Important crosS Applying yaK Herder

52326 Posts

Posted - 07/14/2013 :  07:17:19  Show Profile  Reply with Quote
I dont know about Excel VBA but the query syntax looks fine for SQL Server. can you give more information on the error?

SQL Server MVP
Go to Top of Page

Patron Saint of Lost Yaks

30421 Posts

Posted - 07/14/2013 :  15:23:08  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Underscore character is a line-continuation character.
Let Stu_name in the select clause be a complete column name.

N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Mohamed Gani
Starting Member

2 Posts

Posted - 07/15/2013 :  04:12:35  Show Profile  Reply with Quote
I removed the underscore( _ ) from column name but still error occured.

Err Description : " Syntax Error "

Go to Top of Page

In (Som, Ni, Yak)

17689 Posts

Posted - 07/15/2013 :  04:52:49  Show Profile  Reply with Quote
i think what Peter mean was don't break the "stu_name" into 2 lines, keep the column name stu_name on the same line

Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000