Querying Sharepoint List Item Versions using SQL

The request was simple enough, get the total number of days for a status change from one custom list field to another custom list field  in a Sharepoint List Item. There's a few ways to do this. Assume you have a Sharepoint workflow that changes a list item through various statuses and various fields. A simple way is to create a Date Changed field for each field that you want to track, then to populate it in your workflow as it goes along. If you don't have date fields set up in your list, you can take advantage of the version history if version history is turned on. The key here is to loop through your list items, know which field is the field you want, and then take the first version where the value has changed to the desired value. For example, if you are waiting for a "Status" [...]