Skip to content Skip to sidebar Skip to footer

How Can I Left Out Join These #temp (default Data) And Another Table?

i try to generate a table (look TABLE 1) with the query(below). CREATE TABLE #temp( [VisitingCount] int, [Time] nvarchar(50) ) DECLARE @DateNow DATETIME,@i int SET @DateNow='00:00

Solution 1:

It is your where clause, what filters some time ranges out. You need to set that clause for inner select:

select Count(VisitingCount) as VisitingCount,[Time]      
from   
#temp as Alltimes
left outer join   
( SELECT Page,Date,[user],      
        dbo.fn_GetActivityLogArranger2(Date,'hour') as [Time]
        FROM scr_SecuristLog      
        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)      
        )      
) scr_SecuristLog      
on Alltimes.[Time] = scr_SecuristLog.[Time]
group by [Time] order by [Time] asc

Post a Comment for "How Can I Left Out Join These #temp (default Data) And Another Table?"