select d.name,d.dbsnum,sum(round(chksize/1024/1000*(select pagesize from syschunks where chknum=1),0)) dbsize,sum(round(nfree/1024/1000*(select pagesize from syschunks where chknum=1),0)) dbsfree,d.is_blobspace,d.is_sbspace,d.is_temp
from syschunks k,sysdbspaces d
where k.dbsnum=d.dbsnum
group by 1,2,5,6,7
order by 2