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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:22:04+00:00 2026-06-15T06:22:04+00:00

I have a database, with a few tables. One of them is a customer

  • 0

I have a database, with a few tables. One of them is a customer table, one of them is a rental table, and one of them is a rental details table. Let’s call them C, R and RD respectively. RD has the date_in and date_out of the tools rented, and is linked to R by RD‘s primary key. R is linked to C by customer id.

Basically what I want to do is select (and delete) customers that have not rented anything in the past 3 years. So I can’t use where date_out > sysdate - 3 years [representation not accurate code] because the tool might have been rented out 4 years ago and ALSO last week, so it needs to be kept in the database… I just need to delete tools that haven’t been rented at all in the past 3 years.

I know the database structure is retarded but I can’t change it.

  • 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-15T06:22:05+00:00Added an answer on June 15, 2026 at 6:22 am
    delete from c 
    where not exists ( select * 
                       from r join rd using(r_id) 
                       where c_id=c.c_id and date_out>add_months(sysdate,-36) )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a database with a few tables. The first table contains the
I need to create module in Magento which will have few database tables. One
I have a database with few tables, ex.: Employee (Id, Name, state, country) Material
I have a MS Access database with few tables and a form. When more
I have several database tables that just contain a single column and very few
I have a MySQL database with a few (five to be precise) huge tables.
I have quite a few situations where I have database structures similar to: TABLE
I have a MySQl database with a few tables, all UTF-8 and MyISAM storage.
i have two tables in my database one is A other one is B
Situation I have 5 Access DB files, each one has 10 tables, 40 queries

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.