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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:03:58+00:00 2026-06-05T10:03:58+00:00

In my Activities table I have columns – Activity, ActivityBaseTable, FieldName **Activity** **ActivityBaseTable** **FieldName**

  • 0

In my Activities table I have columns – Activity, ActivityBaseTable, FieldName

**Activity**    **ActivityBaseTable**    **FieldName**
Task            TaskBase                 CreatedOn
Task            TaskBase                 ModifiedOn

What I need a sql statement like –

select Activity, ActivityBaseTable, FieldName, MIN([Date field], MAX([Date field])
from Activities

where the min and max date fields would be –

select min(CreatedOn), Max(CreatedOn)
from TaskBase

or

select min(ModifiedOn), Max(ModifiedOn)
from TaskBase

Can this be written as one statement?

  • 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-05T10:03:59+00:00Added an answer on June 5, 2026 at 10:03 am

    You probably won’t like this as an answer, but if you can revise your data model to not use a table name in a column, that would be much preferrable. Please see here for a great summary of the topic. I’m cringing when I read that you have dozens of rows with different base ActivityBaseTables. I’m at a loss for a design where this is a good idea.

    Depending on your RDBMS, there are lots of examples on this site and others of how to write a stored procedure (which is likely what you’ll need) to do this.

    I’m just going to plead with you to change the data model & avoid the situation entirely.

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

Sidebar

Related Questions

I have 2 Columns in a table. Activities and Average % of Time, For
I have a table activities of activity entries, e.g.: ID | Date | Activity
I have a table called Activities and for each activity I can have zero
I have three tables: CREATE TABLE activities ( activity varchar(20) Primary key ); with
In my Activities table I have a StaffId field. This is a FK of
I have a table that lists the duration of different activities. It looks like
I have two activities in my Android project: Google Map Activity List Activity I'm
I have 4 activities A, B, C and D. Activity A has a menu.
I have three tables. First table is Activities and second is Members and last
I have a table where I want to Log activities of some part of

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.