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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:54:18+00:00 2026-05-23T03:54:18+00:00

I am creating a time machine with c#. A time machine is a way

  • 0

I am creating a time machine with c#. A time machine is a way of creating a backup of my files in the way where I can access a specific file like it was at a specific time. Anyways the way I am doing so is by looking for all the files inside a directory and I store those files information in a table named table1. So if the first time I scan my computer lets assume I only have 3 files therefore my table will look something like:

ID   FullName   DateModified   DateInsertedToDatabase
 1     C:\A       456588731             0
 2     C:\B       955588762             0
 3     C:\C       854587783             0

lets say that next time I perform a back up I have the same 3 files but I have created a new file and modified file C. As a result my table should now look like:

    ID   FullName   DateModified   DateInsertedToDatabase
     1     C:\A       456588731             0
     2     C:\B       955588762             0
     3     C:\C       854587783             0
     4     C:\A       456588731             1
     5     C:\B       955588762             1
     6     C:\C       111122212             1
     7     C:\X       123212321             1

now I will like to copy file C and File X because those are the files that have been changed or created. How could I build a query where I could obtain file X and file C ? In other words I want to get all the files that have a DateInsertedToDatabase = 1 and that don’t match files where DateInsertedToDatabase is less than 1.

if I am not being clear here is the continuation of my example:
lets say that I continue with my example and I delete files: B and C, I modify file X, I create a new file Z. My table should look like:

    ID   FullName   DateModified   DateInsertedToDatabase
     1     C:\A       456588731             0
     2     C:\B       955588762             0
     3     C:\C       854587783             0
     4     C:\A       456588731             1
     5     C:\B       955588762             1
     6     C:\C       111122212             1
     7     C:\X       123212321             1
     8     C:\A       456588731             2
     9     C:\X       898989898             2
     10    C:\Z       789564545             2

here I will like to get files X and Z because file X was modified and File Z was created. I will not want to get file A because that file already exist with the same DateModified. How could I build that query?

  • 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-23T03:54:19+00:00Added an answer on May 23, 2026 at 3:54 am

    Hmm, I think I understand. You want to get all files that match on the MAX(DateInsertedToDatabase) but don’t have a previous row that also matches their DateModified?

    You want to do what I call a “reverse inner join.” Basically a left join that filters out anything that would have successfully matched in an inner join. There are other ways it could be done as well (e.g. using subqueries).

    This is in T-SQL:

    CREATE TABLE #mytemp
    (
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [FullName] [nvarchar](50) NOT NULL,
        DateModified [nvarchar](9) NOT NULL, 
        DateInsertedToDatabase [int] NOT NULL
    )
    
    INSERT INTO #mytemp VALUES ('C:\A', '456588731', '0')
    INSERT INTO #mytemp VALUES ('C:\B', '955588762', '0')
    INSERT INTO #mytemp VALUES ('C:\C', '854587783', '0')
    
    INSERT INTO #mytemp VALUES ('C:\A', '456588731', '1')
    INSERT INTO #mytemp VALUES ('C:\B', '955588762', '1')
    INSERT INTO #mytemp VALUES ('C:\C', '111122212', '1')
    INSERT INTO #mytemp VALUES ('C:\X', '123212321', '1')
    
    INSERT INTO #mytemp VALUES ('C:\A', '456588731', '2')
    INSERT INTO #mytemp VALUES ('C:\X', '898989898', '2')
    INSERT INTO #mytemp VALUES ('C:\Z', '789564545', '2') 
    
    SELECT 
        temp1.*
    FROM 
        #mytemp temp1
        LEFT JOIN #mytemp temp2 ON 
                temp1.ID != temp2.ID --don't match on the same two rows
                AND temp1.FullName = temp2.FullName --match based on full name
                AND temp1.DateModified = temp2.DateModified --and date modified
    WHERE
        temp1.DateInsertedToDatabase = (SELECT MAX(DateInsertedToDatabase) FROM #mytemp)
        AND temp2.ID IS NULL --filter out rows that would have matched on an INNER JOIN 
    
     DROP TABLE #mytemp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to access a virtual Windows XP machine from the Ubuntu 11.04 host
Im linking to a remote linux machine. I want to be able to view
I want to deploy my application. i followed this step but i can't get
I have experienced some troubles when using the IIS server at my workstation with
I'm trying to move a database table to another server; the complication is that
I have a web service that was created several years ago in C++ and
I have a Macintosh and I am trying to automatically load packages, homemade functions,
I want to know about the efficiency of Java and the advantages and disadvantages
My first question here, so go easy on me. This is my situation: I
When I run the app in dev mode (./manage.py runserver 0.0.0.0:9090) everything works fine.

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.