Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 529773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:07:36+00:00 2026-05-13T09:07:36+00:00

I need to be able to find all items in a table where the

  • 0

I need to be able to find all items in a table where the id of each item is not in a relational mapping table. In other words, I have one table where each row has an id. If that id is in a map table, it should not show up in my list.

I was thinking of querying my map table for all id’s in it, then turning around and querying my main table to exclude any items that have that id… so something like:

select * from Main where id not in(select main_id from Map);

Is there a good way to do this with grails either through a findBy method or possibly a criteria builder query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:07:37+00:00Added an answer on May 13, 2026 at 9:07 am

    If you’re using Hibernate, you should be able to do that with HQL, using a not in and a subquery (here’s a page of examples):

    from Main as main where main.id not in (select map.main_id from Map as map)
    

    Based on this page, I believe you need to execute this query in a Main.findAll method:

    def results = Main.findAll("from Main as main where main.id not in (select map.main_id from Map as map)")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table whose columns indicate a property of data items. Each item
I want to find items in common from the following_list column in a table
I have a list of items heading that are all in INTEGER (yes the
Have/Want List Matching Algorithm I am implementing an item trading system on a high-traffic
I have a table called Stock and another called Listed, within the Stock Table
I have the following tables: TABLE: category catid catfatherid catname 1 0 United States
I have a database to keep track of the services clients have. But need
First of all, some links to pages I've used for reference: A SO question
I have the following function: CREATE FUNCTION [dbo].[ListStockBySubCategory] ( @CategoryID varchar(10), @SubCategoryID varchar(10), @startRowIndex
My schema has the following relations: User hasMany Transaction belongsTo User Item hasMany Transaction

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.