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

  • Home
  • SEARCH
  • 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 8866157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:43:01+00:00 2026-06-14T16:43:01+00:00

SELECT users.email FROM users INNER JOIN orders ON orders.user_id = users.id WHERE orders.status =

  • 0
SELECT users.email FROM users
INNER JOIN orders
ON orders.user_id = users.id
WHERE orders.status = 'new'
AND orders.date_created > three months back?

I would like to grab all users email that have NOT made an order on my site within 3 months from today. So if no order within 3 months, grab the email.

date_created is type TIMESTAMP. So an example is: 2012-11-10 23:54:20

Also I would like an query for grabbing users email who have not made any orders at all (no rows in orders table)?

I tried with:

SELECT users.email FROM users
    WHERE users.id NOT IN (select user_id from orders where user_id = users.id and orders.status = 'new')

But it seems to grab users with orders anyway?

  • 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-14T16:43:02+00:00Added an answer on June 14, 2026 at 4:43 pm
    1. I would like to grab all users email that have NOT made an order on my site within 3 months from today.

      Group the orders by user and filter the results for those where the most recent order is more than 3 months ago:

      SELECT   users.email
      FROM     users JOIN orders ON orders.user_id = users.id
      GROUP BY orders.user_id
      HAVING   MAX(orders.date_created) < CURRENT_DATE - INTERVAL 3 MONTH;
      
    2. Also I would like an query for grabbing users email who have not made any orders at all (no rows in orders table)?

      Make an outer join and filter for records that fall outside of the intersection:

      SELECT   users.email
      FROM     users LEFT JOIN orders ON orders.user_id = users.id
      WHERE    orders.user_id IS NULL
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$sql = SELECT * FROM books LEFT JOIN users ON books.readby=users.user_id WHERE users.email IS
Say I have the following: $query = SELECT user_id,email,password, roles.role_id,role_name FROM users JOIN roles
This problem is baffling me: BEGIN; INSERT INTO sub_users(user_id, email) SELECT user_id FROM users
This is the code I have : $sqlz = SELECT t1.user_id, t2.status, t2.email FROM
SELECT title,name FROM Lessons,Users WHERE Lessons.author = Users.email; and SELECT title,name FROM Lessons JOIN
It's easy to find duplicates with one field: SELECT email, COUNT(email) FROM users GROUP
These two queries work: SELECT u.id, u.email, COUNT(*) as Current FROM users u, rounds
I tried this select posts.id, posts.title from posts inner join ( select post_id,max(created) from
The sql query: select id,title from blog_post inner join (select object_pk, max(submit_date) from django_comments
I to do connection and have error. from u in db.aspnet_users where u.UserName.Equals(email) select

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.