Solved

MS Access where in clause

Posted on 2010-11-09
5
412 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
  • 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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