Here's a tough one! Standard deviation on lead times

Using SAP Business One 8.82

I have been laboring away trying to create an SQL to produce the following resultant report:

time in days from Item purchase to item goods receipt for a specific date range.

I am attempting to gather all purchasing and receipt information (with qty and date) for a number of items over a three year, or more, period for the purpose of analyzing average lead time and standard deviations.