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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:05:47+00:00 2026-06-02T15:05:47+00:00

I have the following Query: SELECT a.name_f, a.uid, a.name_l, a.profile_pic, b.position FROM users a

  • 0

I have the following Query:

SELECT a.name_f, a.uid, a.name_l, a.profile_pic, b.position FROM users a groups_members b, WHERE a.uid = b.userid AND b.group_id=$group_var

This works great and brings back all of the users’ info as well as their positions within the group for any certain group that I want to call. When a group attends an event, on that event page I want to call the above function but also an extra statement that finds whether that user is confirmed. So I run the following query:

SELECT a.name_f, a.uid, a.name_l, a.profile_pic, b.position, c.confirmed FROM users a groups_members b, event_users c WHERE a.uid = b.userid AND b.group_id='$group_var' and c.event_id ='$event_var' and a.uid = c.userid

This also works great but here’s where my problem arises. Let’s assume that a certain group has created an event and subsequently, all of the users have been dumped into the event_users table. My 2nd query would still work and show every user in that group as well as his or her and confirmed setting but when a new user joins the group and selects his or her position, that new user is not returned in my second query and therefore, the event that shows all of the users’ along with their position, does not account for any new users that were added after the event was created.

I hope that doesn’t sound too confusing. Here are my tables:

event_users || id, event_id, userid, confirmed    

groups_members || id, userid, group_id, position

users || uid, name_f, name_l, profile

My question is how can I basically collect all of the current group members and subsequently if they have been entered into the event_users table, what is their confirmed status. I do not want to run queries on my group page that accounts for new users and puts them into any events that the group has

  • 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-06-02T15:05:47+00:00Added an answer on June 2, 2026 at 3:05 pm

    Use left joins:

        SELECT 
          a.name_f, a.uid, a.name_l, a.profile_pic, b.position, c.confirmed 
        FROM users a 
        JOIN groups_members b on a.uid = b.userid
        LEFT JOIN event_users c on a.uid = c.userid
        WHERE b.group_id='$group_var' and c.event_id ='$event_var'
    

    You will be getting NULL as a value of c.confirmed if there is no correspondent record in event_users table. You may use coalesce() function to put there default value:

         coalesce(c.confirmed, 0)
    

    or

         coalesce(c.confirmed, 'not subscribed yet')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SELECT a.uid, a.name_f, a.name_l, b.position FROM users a, room_members b WHERE a.uid = b.userid
I have the following tables users: uid, name_f, name_l... group_data: id, group_id, admin, invitedusers,
I have a following SQL QUERY: SELECT articles.name, articles.price, users.zipcode FROM articles INNER JOIN
I have the following query: select column_name, count(column_name) from table group by column_name having
I have the following query: SELECT DISTINCT w.name, count(*) FROM widgets AS w JOIN
I have the following query: SELECT o.id,o.name FROM object o WHERE ( o.description LIKE
I have the following mysql query: $manufacturers_query = select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from
I have the following code $result = $handle->select()->from('store_details') ->where('store_details.store_id=?', $id) ->columns('store_details.store_name'); //->query(ZEND_DB::FETCH_OBJ); However, when
I have the following query: SELECT id,name FROM categ WHERE email_activated='1' ORDER BY id
I have the following query: SELECT * FROM scool LEFT JOIN people as t1

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.