I have a table that contains Road reference numbers and road length, with columns RoadID (int) and RoadLength (int).
There are around 3000 rows. Using T-SQL I need to extract a random selection of road references and their length where the sum of the length adds up to 5% of the
total length of all the roads in the table. This is for an annual road survey where roads are selected at random.
I'm using T-SQL against a SQL Server 2008 database. Tried a few variations on triangular queries from this article http://www.sqlservercentral.com/Forums/Topic793008
-149-1.aspx but struggling with selecting random rows. I tried using order by newID() but my results don't look correct.
Any help with the most efficient way to do this would be appreciated. Thanks
Thanks in advance!