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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:26:30+00:00 2026-06-05T16:26:30+00:00

I have two tables user table user_id | name | 1 | peter |

  • 0

I have two tables

user table

 user_id | name  |
    1    | peter |
    2    | kofi  |
    3    | sam   |
    4    | nasah |
    5    | sarah |
    6    | david |
    7    | dan   |

time table

 time_id | user_id | register
    1    |     1   |  present
    2    |     2   |  absent
    3    |     3   |  absent
    4    |     4   |  present
    5    |     5   |  absent

in the “time” table under “register” column, user can iether register “present” or “absent” when they login into the system.

I want a mysql query that select users who have either register “absent” or has not register at all.

the return result should be

kofi  | absent
sam   | absent
sarah | absent
david | 
dan   | 
  • 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-05T16:26:31+00:00Added an answer on June 5, 2026 at 4:26 pm

    What about this

    SELECT t2.name, t1.register 
    FROM time t1
    RIGHT JOIN user t2
    ON t2.user_id=t1.user_id
    WHERE (t1.register = 'absent' OR t1.register is null)
    

    Its working, tested here.


    Update 1

    Per you conversation, you want to further filter based on time/ date

    let say i want to find out those who where absent or did not enter the system before 06-13-12 assuming there is a column name “date” in the time table

    Use below query

    SELECT t2.name, t1.register, t1.mydate 
    FROM time t1
    RIGHT JOIN user t2
    ON t2.user_id=t1.user_id
    WHERE 
         (t1.register = 'absent' OR t1.register is null)
         AND
         (t1.mydate <= '2012-06-13' OR t1.mydate is null)
    

    Here is demo for new requirement


    Hope this is what you wanted.

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

Sidebar

Related Questions

I have two tables. User table has user_id and order_num Orders table has order_num,
I have two tables users table: id|name user_relationships id | user_id | friend_id and
I have two tables User id name Result id user_id score created_at Every hour
I have two tables. Table user contains user_id, user_name. Table Transactions contains user_id, transactions
I have user and user_role tables. The user_role table has two columns: user_id role_name
I have two tables like of this structure: content (content_id, content_type, user_id, time, comment_count)
I have two tables in my database: user and media_contact . The media_contact table
I have these two tables. Leave Table from_date to_date user_id 2011-12-01 2011-12-01 1 2011-12-01
I have two tables: Personnel with ID,Name,... columns and User with PersonnelID (FK of
I Have two tables: Users and News. Table News has columns id, name, createdby,

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.