Solved

MS Access where in clause

Posted on 2010-11-09
5
461 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 500 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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.

739 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