Results 1 to 3 of 3
  1. #1
    magnusstefan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Saltsjöbaden, Sweden
    Posts
    52

    Is embedded SELECT statement possible in MS Access (2013)?

    Example from a Recipe Database when using two tables for an INNER JOIN:
    1) Recipe_Classes with fields RecipeClassID and RecipeClassDescription


    2) Recipes with fields RecipeTitle and Preparation

    I am here trying to use an embedded SELECT statement for filtering as a part of INNER JOIN. The purpose is to show only recipes in the categories "Main course" or Dessert", but instead of a result set i got: "State parameter value RC.Classname".

    Here is the code:
    Code:
    SELECT R.RecipeTitle, R.Preparation, RCFiltered.ClassName
    FROM (SELECT RecipeClassID, RecipeClassDescription AS ClassName FROM Recipe_Classes AS RC WHERE RC.ClassName = 'Main course' OR RC.ClassName = 'Dessert') AS RCFiltered
    INNER JOIN Recipes AS R 
    ON RCFiltered.RecipeClassID = R.RecipeClassID;

    This is not possible in Access, or?

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Yes possible. This construct is called a subquery.

    See Allen Browne subquery
    more on subquery

    Good luck.

  3. #3
    magnusstefan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Saltsjöbaden, Sweden
    Posts
    52
    Excellent!

    I will check this up.

    Thank you!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Outlook 2013 + Access 2013 + HTML
    By Yann63 in forum Programming
    Replies: 2
    Last Post: 11-26-2013, 02:39 PM
  2. Access 2013 Web App with Sharepoint 2013
    By miguel.escobar in forum Access
    Replies: 7
    Last Post: 06-17-2013, 09:03 AM
  3. Replies: 6
    Last Post: 02-19-2013, 03:38 PM
  4. Use Parameter in select statement (Sql in Access)
    By mohammadyou in forum Access
    Replies: 6
    Last Post: 06-04-2012, 01:40 PM
  5. Replies: 1
    Last Post: 05-13-2010, 10:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums