Thursday, July 31, 2014

How to implement poor-man's version control with TSQL queries

I have a table called Project. Each row completely describes a project and has a username, project name, project description and other numeric parameters that contain all the data about the project.


When multiple rows have the same username, this means a user owns multiple projects.


Now I want to implement a poor-man's version control for my users by adding a new integer column called version. When a user wants to save a new version of his project, the version is incremented and a new row is inserted into the table.


Some projects will have 1 version, others will have a dozen or more.


By default, the user should see a data grid of projects where only the latest version of the project is displayed (including the version count) and all the older versions of each project are ignored.


How do I write a TSQL query to populate this data grid (and ignore every version except the latest versions of each project)?


Thanks


Siegfried




siegfried heintze


No comments:

Post a Comment