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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:48:09+00:00 2026-06-16T13:48:09+00:00

Firstly i apologize for vague question title, i am not sure what to write

  • 0

Firstly i apologize for vague question title, i am not sure what to write there. Please let me know and i will update it.

Now here it goes..
I have 3

Table   : target
Columns : target_id , target_employee_id, target_location_id, target_location_name, target_scheduled_on, target_exec_end_time, target_damaged, target_damaged_text


Table   : employee  
Columns : employee_id, employee_manager_id

Table   : location
Columns : location_id, location_name

Little Explaination-> Managers role is to create a target for employee meaning a new target will have the location name and the scheduled on. Then employee will visit that location and report if there are any damages. This can happen multiple times in a month for same location.

What i need to show-> a list of targets having damages – between two dates (target_exec_end_time) and if there are multiple records of that same location then show the one having max date.

More Explaination-> There can be multiple entries of targets having same location but i need to show only one instance. target table image

I have tried my best to explain. Thanks in advance.

  • 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-16T13:48:10+00:00Added an answer on June 16, 2026 at 1:48 pm

    How about this:

     select * from target join employee on target.target_employee_id = employee.employee_id
         join location on target.target_location_name = location.location_name
         where target_exec_end_time between <start_date> and <end_date>
            and target_exec_end_time = (select max(target_exec_end_time) from location loc2
            where loc2.location_name = target.location_name)
         group by target.location_name;
    

    Not sure about having both target_exec_end_time clauses in the where though. Maybe you just want the max value?

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

Sidebar

Related Questions

Firstly, apologies for the vague title, but I'm not sure exactly what I'm asking
Firstly, apologies for the bad question title - not entirely sure if I am
firstly, I very much apologize for my poorly written title of this question. So
firstly, I apologize if my question sounds little confusing, I will try my best
Firstly, I want to apologize for my English, not my strongest side. To the
Firstly, let me say that I know that http://sphinxsearch.com/docs/current.html#conf-sql-attr-string says strings can only be
Firstly, let me apologise for the title, I honestly couldn't think how to word
Firstly apologies for the title, I don't know if it describes what I am
Firstly, apologies for the title, I could not think of a suitable one. I
Firstly, I'm new to Android (so I apologize if this question is ignorant) but

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.