I need to track changes created in a directory and also saved the history. I have a function that scans the files in that directory then it inserts them in a table. let's say that the first time this program was run there where files A, and B. As a result the table should look like 

```
FileID     File      DateModified       
  1         A          101010     
  2         B          020202

```

let's say the user modifies file B therefore the next time the program runs the table should look like:

```
FileID     File      DateModified       
  1         A          101010     
  2         B          020202              
  3         A          101010     
  4         B          030303

```

From looking at the table above we know that file B has been changed because it has a different modified date and also that file A was not modified. Moreover my program know that the records that where inserted are all the records with a fileID greater than 2. How could I perform a select that will return the last file B because that file was modified. I want to be able to know which files have been modified how could I build that query. 

Please read above first in order to understand this part. Here is another example. 

```
First time program runs:

FileID     File      DateModified       
  1         X          101010     
  2         Y          020202

Next time program runs:

FileID     File      DateModified       
  1         X          101010     
  2         Y          020202   
  3         Y          020202            
  4         A          010101

```

so far we know that file X has been deleted because it is not included in the new scan. Moreover we know that file A has been created. And lastly that File Y was not modified it is the same. I would like to perform a select where I can just get the files that where created or modified such as file A in this case. 

I am looking for something like:

```
select * from table1 where fileID > 2 AND File NOT IN (SELECT File FROM table1 WHERE File <=2) AND DateModified NOT IN (SELECT DateModified FROM table1 WHERE File <=2)

```

I don't know why is it that when I perform such query I get different results. Maybe I will have to group the File and DateModified into one column to make it work.