By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,897 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

PLEASE HELP with Query

P: n/a
I am trying to use a IN statement

Select * From ShowMenusFirst WHERE (Security In ((select Security from Users
Where (Username='mkintner')))) ORDER BY Menus.Level;

The results from the query select Security from Users Where
(Username='mkintner') is 'Low','Med'

I wanted the IN Statement to be WHERE Security IN ('Low','Med')

If I type out the SQL Select * From ShowMenusFirst WHERE (Security In
('Low','Med')) it works fine but for some reason adding the select
statement inside of the IN statement nothing happens, any ideas as to why
this is not working?

Mike
Aug 17 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a

Michael Kintner wrote:
I am trying to use a IN statement

Select * From ShowMenusFirst WHERE (Security In ((select Security from Users
Where (Username='mkintner')))) ORDER BY Menus.Level;

The results from the query select Security from Users Where
(Username='mkintner') is 'Low','Med'

I wanted the IN Statement to be WHERE Security IN ('Low','Med')

If I type out the SQL Select * From ShowMenusFirst WHERE (Security In
('Low','Med')) it works fine but for some reason adding the select
statement inside of the IN statement nothing happens, any ideas as to why
this is not working?

Mike
I believe you can only use the "in" statement on numbers. It doesn't
work with other characters.

Aug 17 '06 #2

P: n/a
You can use alpha characters. Becasue the one statement with Low and Med
does not, I just don't know how to pass the info from teh select statement
into the IN statement.

"Cyberwolf" <cy**********@gmail.comwrote in message
news:11********************@75g2000cwc.googlegroup s.com...
>
Michael Kintner wrote:
>I am trying to use a IN statement

Select * From ShowMenusFirst WHERE (Security In ((select Security from
Users
Where (Username='mkintner')))) ORDER BY Menus.Level;

The results from the query select Security from Users Where
(Username='mkintner') is 'Low','Med'

I wanted the IN Statement to be WHERE Security IN ('Low','Med')

If I type out the SQL Select * From ShowMenusFirst WHERE (Security In
('Low','Med')) it works fine but for some reason adding the select
statement inside of the IN statement nothing happens, any ideas as to why
this is not working?

Mike

I believe you can only use the "in" statement on numbers. It doesn't
work with other characters.

Aug 17 '06 #3

P: n/a

"Michael Kintner" <no****@nospam.comwrote in message
news:12************@corp.supernews.com...
I am trying to use a IN statement

Select * From ShowMenusFirst WHERE (Security In ((select Security from
Users
Where (Username='mkintner')))) ORDER BY Menus.Level;

The results from the query select Security from Users Where
(Username='mkintner') is 'Low','Med'

I wanted the IN Statement to be WHERE Security IN ('Low','Med')

If I type out the SQL Select * From ShowMenusFirst WHERE (Security In
('Low','Med')) it works fine but for some reason adding the select
statement inside of the IN statement nothing happens, any ideas as to why
this is not working?

Mike

I am guessing, but your current select will return rows of security levels,
IN needs a list.

Aug 17 '06 #4

P: n/a
Michael Kintner wrote:
I am trying to use a IN statement

Select * From ShowMenusFirst WHERE (Security In ((select Security from Users
Where (Username='mkintner')))) ORDER BY Menus.Level;

The results from the query select Security from Users Where
(Username='mkintner') is 'Low','Med'

I wanted the IN Statement to be WHERE Security IN ('Low','Med')

If I type out the SQL Select * From ShowMenusFirst WHERE (Security In
('Low','Med')) it works fine but for some reason adding the select
statement inside of the IN statement nothing happens, any ideas as to why
this is not working?

Mike

I'm not clear on what your desired outcome is.

If Security is both in ShowMenusFirst and Users, why the nested query?

Also, your ORDER BY clause appears to reference a table not in the FROM
clause.
--
Smartin
Aug 17 '06 #5

P: n/a
* Michael Kintner:
I am trying to use a IN statement

Select * From ShowMenusFirst WHERE (Security In ((select Security from Users
Where (Username='mkintner')))) ORDER BY Menus.Level;

The results from the query select Security from Users Where
(Username='mkintner') is 'Low','Med'

I wanted the IN Statement to be WHERE Security IN ('Low','Med')

If I type out the SQL Select * From ShowMenusFirst WHERE (Security In
('Low','Med')) it works fine but for some reason adding the select
statement inside of the IN statement nothing happens, any ideas as to why
this is not working?

Mike

Mike,

Where does "Menus.Level" come from? Other than the ORDER BY, your SQL
should work.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Aug 18 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.