?
Solved

MS Access where in clause

Posted on 2010-11-09
5
Medium Priority
?
518 Views
Last Modified: 2012-05-10
Is it possible to write a where in clause in MS Access SQL?

Example:

select * from mytable where myfield in (select top 6 myfieldlookup from othertable) as t1
0
Comment
Question by:dougfosterNYC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34095650
yes..



0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 34095669
this is already good to go

select * from mytable where myfield in (select top 6 myfieldlookup from othertable)
0
 

Author Comment

by:dougfosterNYC
ID: 34095686
OMG.  It is the as t1 statement that screwed it up.  
 
Thanks....
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 34095702
two things

with this, the table alias cannot be placed here like this (as t1). you would place it within the from part
second, myfield must match the datatype of myfieldlookup

select * from mytable where myfield in (select top 6 myfieldlookup from othertable)

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 34095722
way too slow lol
0

Featured Post

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question