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 6548841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:01:13+00:00 2026-05-25T12:01:13+00:00

Hi I am looking to select rows in my database that are not in

  • 0

Hi I am looking to select rows in my database that are not in another table. If the foreign keyed row exists I don’t want the table row included in the result set.

For example:

Group Table
Id - Title - Motto - Logo

Member Table
Id - FirstName - LastName

GroupMemberMap Table
Id - Group - Member

I want to get all the members that are not assigned to a group.

Anyone know how to do that with Propel?

  • 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-25T12:01:14+00:00Added an answer on May 25, 2026 at 12:01 pm

    Two examples:

    Left join

    SELECT * FROM member m LEFT JOIN member_group mg ON mg.member_id = m.id WHERE mg.member_id IS NULL

    $c = new Criteria();
    $c->addJoin(MemberPeer::ID, MemberGroupPeer::MEMBER_ID, Criteria::LEFT_JOIN);
    $c->add(MemberGroupPeer::MEMBER_ID, NULL, Criteria::ISNULL);
    
    return MemberPeer::doSelect($c);
    

    Sub query

    SELECT * FROM member m WHERE id NOT IN (SELECT DISTINCT(member_id) FROM member_group)

    $c = new Criteria();
    $subQuery = sprintf('SELECT DISTINCT(%s) FROM %s', MemberGroupPeer::MEMBER_ID, MemberGroupPeer::TABLE_NAME);
    $c->add(MemberPeer::ID, MemberPeer::ID . ' NOT IN (' . $subQuery . ')', Criteria::CUSTOM);
    
    return MemberPeer::doSelect($c);
    

    Let me know. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been looking at fast ways to select a random row from a table
I'm trying to move a database table to another server; the complication is that
i am looking for an SQL query, that selects exactly rows ordered by date
I am looking for a searchable multiple select javascript widget that can handle filtering
I looking for a script that will enable me to select an area in
I am looking for a database that could handle (create an index on a
(Advantage Database Server) I have a table of service providers that, for auditing purposes,
I have an ecommerce MySQL database that stores order information in the table 'orders'
I'm looking for a way to select until a sum is reached. My "documents"
I'm looking for the best way to select numbers directly from an in clause.

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.