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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:21:46+00:00 2026-05-22T12:21:46+00:00

Hi all I have an appointments table that has among other fields a DATE

  • 0

Hi all I have an appointments table that has among other fields a DATE field that records the date of the appointment. The show create statement is below.

 | groomappointments | CREATE TABLE `groomappointments` (
   `gapmtDate` date NOT NULL,
   `gapmtClient` int(11) NOT NULL,
   `gapmtUser` int(11) NOT NULL,
   `gapmtStatus` int(11) NOT NULL DEFAULT '1',
   `gapmtSTime` time NOT NULL,
   `gapmtETime` time NOT NULL,
   `gapmtPet` int(11) DEFAULT NULL,
   `gapmtService` int(11) DEFAULT NULL,
   `gapmtTracker` int(11) NOT NULL AUTO_INCREMENT,
   PRIMARY KEY (`gapmtDate`,`gapmtClient`,`gapmtUser`,`gapmtStatus`,`gapmtSTime`),
   KEY `gappPet` (`gapmtPet`),
   KEY `gappClient` (`gapmtClient`),
   KEY `gappSrve` (`gapmtService`),
   KEY `gappStat` (`gapmtStatus`),
   KEY `gappUsr` (`gapmtUser`),
   KEY `gapmtTracker` (`gapmtTracker`),
   CONSTRAINT `gappClient` FOREIGN KEY (`gapmtClient`) REFERENCES `clients` (`clientid`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `gappPet` FOREIGN KEY (`gapmtPet`) REFERENCES `pets` (`petID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `gappSrve` FOREIGN KEY (`gapmtService`) REFERENCES `groomservices` (`groomServicesID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `gappStat` FOREIGN KEY (`gapmtStatus`) REFERENCES `aptstatus` (`aptStatusID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `gappUsr` FOREIGN KEY (`gapmtUser`) REFERENCES `users` (`userID`) ON DELETE NO ACTION ON UPDATE NO ACTION
  ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 |

I’m trying to query the database to find all clients whose last appointment was recorded six months or more in the past, but I can not figure out the correct query.

I’ve tried the following query which will give me all records that are recorded 6Mts+ in the past but includes clients who have had appointments in the last week, month etc.

 mysql> select groomappointments.gapmtDate, clients.firstname, clients.lastname
-> from groomappointments,clients
-> WHERE date_sub(CURDATE(), INTERVAL 6 MONTH)>gapmtDate
-> AND clients.clientid = groomappointments.gapmtClient;

Any ideas greatly appreciated.

  • 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-22T12:21:47+00:00Added an answer on May 22, 2026 at 12:21 pm
    select clients.firstname, clients.lastname, groomappointments.gapmtDate
    from clients join groomappointments on clients.clientid = groomappointments.gapmtClient
    where clients.clientid in (
      select gapmtClient from groomappointments
      group by gapmtClient
      where date_sub(CURDATE(), INTERVAL 6 MONTH) > gapmtDate
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table which records all field changes in all database tables
I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files.
I have a MFC dialog with 32 CComboBoxes on it that all have the
So I have a form with lots of controls that all have a tab
I have a small problem. I am creating an appointment table where in the
Lets say all I have is a bunch of timestamps that represent the time
I'm sure we all have received the wonderfully vague Object reference not set to
I have created a bunch of movie clips which all have similar names and
I have many emails coming in from different sources. they all have attachments, many
My Situation I have a N rectangles The rectangles all have the same shape

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.