Im trying to search a item table, there is an id, name and oldId (can be null)
When an item is updated a new row is created with the new data, and the old id of the item is set to the new rows OldId field.
But i cant figgure out how to show the latest revision of the item and those who are unedited during search.
var q = from i in Items where i.Name.Contains(x) select i;
Ideas?
If I understand your question correctly, each row whose ID is not used in any other row in the OldId column is the latest revision of its item.
This would lead to the following:
In SQL, I would write it like this: