
SELECT  *
FROM (SELECT * FROM myTable) AS T1
JOIN (select myDataColumn, CAST(kilobytes / 1024.0 as numeric(36,2)) as Megabytes
    from (
      select *, bytes / 1024.0 as kilobytes
      from (
        select *, datalength(PDF) as bytes
        from myTable       
      ) a
    ) b
) AS T2
ON T1.ID = T2.VersionID
ORDER BY Megabytes desc


