select ROFSTID, DTS, (Select Count( *) from Figures ff where ff.rofstid = ru.rofstid) ImageFiles from ROfsts ru