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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:12:02+00:00 2026-05-13T11:12:02+00:00

In this table I store changeable values for certain spids. As days go by,

  • 0

In this table I store changeable values for certain spids.
As days go by, these values can change, and an spid can get a new value.

Now I want to find out until when a certain value is enabled.

This is the data for a single spids

uid  spid   propertyvalue   creationdate      
--------------------------------------------------
1    3      First name       2010-01-17 22:34:00
37   3      Second name      2010-01-18 01:07:24
38   3      Third name       2010-01-18 01:09:00
39   3      Fourth name      2010-01-18 01:18:16
40   3      Fifth name       2010-01-18 01:20:02

So the first value starts at 2010-01-18 01:07:24 and would be valid until 2010-01-18 01:01:00.

I already tried this query:

SELECT s1 . * , 
       s2.creationdate AS datetwo
  FROM salespointproperty s1
  JOIN salespointproperty s2 ON s1.spid = s2.spid
                            AND s1.creationdate < s2.creationdate

That gives me a lot of double-records (some of them wrong), and it always leaves out the last new name (as it doesn’t have a new creationdate following it)
Example:

uid spid    propertyvalue    creationdate           datetwo
-------------------------------------------------------------- 
1   3       First name       2010-01-17 22:34:00    2010-01-18 01:07:24 *
1   3       First name       2010-01-17 22:34:00    2010-01-18 01:09:00
37  3       Second name      2010-01-18 01:07:24    2010-01-18 01:09:00 *
1   3       First name       2010-01-17 22:34:00    2010-01-18 01:18:16
37  3       Second name      2010-01-18 01:07:24    2010-01-18 01:18:16
38  3       Third name       2010-01-18 01:09:00    2010-01-18 01:18:16 *
1   3       First name       2010-01-17 22:34:00    2010-01-18 01:20:02
37  3       Second name      2010-01-18 01:07:24    2010-01-18 01:20:02
38  3       Third name       2010-01-18 01:09:00    2010-01-18 01:20:02
39  3       Fourth name      2010-01-18 01:18:16    2010-01-18 01:20:02 *

Only the lines with an asterix are correct. The fifth name is missing.

  • 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-13T11:12:02+00:00Added an answer on May 13, 2026 at 11:12 am

    Assuming that in your example, uid 37 is valid until uid 38, uid 38 is valid until uid 39 etc.

    SELECT
      s1.uid,
      s1.spid,
      s1.propertyvalue,
      s1.creationdate,
      MIN(s2.creationdate) AS datetwo
    FROM salespointproperty s1
    INNER JOIN salespointproperty s2
        ON s1.spid = s2.spid
        AND s1.creationdate < s2.creationdate
    GROUP BY
      s1.uid,
      s1.spid,
      s1.propertyvalue,
      s1.creationdate;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 266k
  • Answers 266k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In previous versions of Xcode, there were two split views… May 13, 2026 at 12:42 pm
  • Editorial Team
    Editorial Team added an answer MeasureText is not known to be accurate. Heres a better… May 13, 2026 at 12:42 pm
  • Editorial Team
    Editorial Team added an answer tempAccounts = GlobusFileHelper.ReadFiletoStringList(Path); foreach (string AcctData in tempAccounts) { string[]… May 13, 2026 at 12:42 pm

Related Questions

The task is to take a list of tables which is changeable. Write a
I have a MySQL table, with the field ('ad_id'). I store variables in different
I have title (varchar), description (text), keywords (varchar) fields in my mysql table. I
I am working on social networking site. now our team decide to store user
Here is the scenario 1. I have a table called items, inside the table

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.