I have Table1 and I need to get it to look like Table2:
VisitingCount | Date
-----------------------
1 | 15:09
3 |
You can join to your table like a view and have your function call there. That way you can call the group by and order by on the column from the view.
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