SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

Mohamed Gani
Starting Member

India
2 Posts

Posted - 07/14/2013 :  06:49:30  Show Profile  Reply with Quote
Hi,
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
('JACK', 'WILLIAM') AND
stu_class IN ( 10,12)
But it doesn't work.
does it possible to use
multiple IN operator for
different column ?
Thanks in advance

gani

visakh16
Very Important crosS Applying yaK Herder

India
52249 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
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
29910 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

India
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 "

gani
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17437 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


KH
Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000