Anda dapat bergabung ke tabel Anda seperti tampilan dan memanggil fungsi Anda di sana. Dengan begitu Anda dapat memanggil grup dengan dan memesan berdasarkan pada kolom dari tampilan.
select
Count(Page) as VisitingCount,
[Time]
from
(
SELECT
Page,
Date,
[user],
dbo.fn_GetActivityLogsArranger(CONVERT(VARCHAR(5),Date, 108)) as [Time]
FROM
scr_SecuristLog
) scr_SecuristLog2
where
Date between '2009-04-30' and '2009-05-02'
and
[user] in
(
select
USERNAME
from
scr_CustomerAuthorities
where
customerID=Convert(varchar,4)
and
ID=Convert(varchar,43)
)
group by
[Time]
order by
[Time] asc