Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Data in multiple columns

Author  Topic 

ereader
Yak Posting Veteran

50 Posts

Posted - 2003-04-25 : 01:33:05
Hi ALL

-- This graph is displaying the Detail Visit The Number Of Users and the details of the last week visit Per Hour

SELECT hour1 , [Users Visit]
FROM (
SELECT CAST(DATEPART(hh,Online_visit) AS VARCHAR(11)) AS 'Hour1'
,COUNT(Online_visit) AS 'Users Visit'
FROM ONLINE_STATISTICS
WHERE CONVERT(VARCHAR(11)
,Online_visit,106)=CONVERT(VARCHAR(11)
,Getdate(),106)
AND online_visit IS NOT NULL
OR DATEDIFF(DAY,Online_visit,GETDATE())=7
GROUP BY CONVERT(VARCHAR(11)
,Online_visit,106),
CAST(DATEPART(hh,Online_visit) AS VARCHAR(11))
)table1
ORDER BY CAST(hour1 AS INT)

The result is the mix match of the current date data with the last week data


hour1 Users Visit
----- ------------
11 30
12 40
13 50
11 70
12 60
13 50

what i'll be looking in the format like this

hour1 Users Visit Lastweek
----- ------------ ---------
11 30 70
12 40 60
13 50 50




AndyB13
Aged Yak Warrior

583 Posts

Posted - 2003-04-25 : 05:12:30
Hi
Have a look at this article

[url]http://www.sqlteam.com/item.asp?ItemID=5741[/url]

Andy

Go to Top of Page
   

- Advertisement -