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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 multiple IN operator for different column

Author  Topic 

Mohamed Gani
Starting Member

2 Posts

Posted - 2013-07-14 : 06:49:30
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

52326 Posts

Posted - 2013-07-14 : 07:17:19
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

30421 Posts

Posted - 2013-07-14 : 15:23:08
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 - 2013-07-15 : 04:12:35
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)

17689 Posts

Posted - 2013-07-15 : 04:52:49
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
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -