hi I've got the code below, which works ok, allows the operator to choose parameters, for service, location and between dates.
I'd like to create a timeframe graph as the result (showing total number of calls within each timeframe), for hourly timeframes 8-9, 9-10, 10-11 etc until 4-5.
the time is held within the column a.TIMESTARTED, so for example between 01/01/06 and 01/01/06 it reurns
01/01/2006 09:48:23
01/01/2006 09:58:23
01/01/2006 10:58:23
01/01/2006 10:18:23
01/01/2006 10:28:23
01/01/2006 10:29:23
so i'd like my graph to be
9-10 = 2 calls
10-11 = 4 calls
how can i go about this please ?
many thanks
jacq
I'd like to create a timeframe graph as the result (showing total number of calls within each timeframe), for hourly timeframes 8-9, 9-10, 10-11 etc until 4-5.
the time is held within the column a.TIMESTARTED, so for example between 01/01/06 and 01/01/06 it reurns
01/01/2006 09:48:23
01/01/2006 09:58:23
01/01/2006 10:58:23
01/01/2006 10:18:23
01/01/2006 10:28:23
01/01/2006 10:29:23
so i'd like my graph to be
9-10 = 2 calls
10-11 = 4 calls
how can i go about this please ?
many thanks
jacq
Code:
SELECT a.DURATION, CONVERT(char(10), CONVERT(char(10), a.TIMESTARTED, 103)) AS CallStarted,
a.ENQUIRYID, a.LOCATION, b.TYPEDESC, b.ID, c.LOCATIONID, a.TIMESTARTED FROM a INNER JOIN d ON a.ENQUIRYID = d.ENQUIRY INNER JOIN c ON a.LOCATION = c.LOCATIONID AND d.OWNINGLOCATION = c.LOCATIONID INNER JOIN
b ON d.ENQUIRY_TYPES_ID = b.ID
WHERE (c.AUTHORITYID = 'CH') AND (a.SEQUENCENO = 0) AND (b.ID = @TYPEID) AND (c.LOCATIONID = @LOCATIONID OR @LOCATIONID = '-1') AND (CONVERT(char(10), CONVERT(char(10), a.TIMESTARTED, 103)) BETWEEN @DATEFROM AND @DATETO) OR (c.AUTHORITYID = 'CH') AND (a.SEQUENCENO = 0) AND (c.LOCATIONID = @LOCATIONID OR
@LOCATIONID = '-1') AND (@TYPEID = '-1') AND (CONVERT(char(10), CONVERT(char(10), a.TIMESTARTED, 103)) BETWEEN
@DATEFROM AND @DATETO)
GROUP BY a.DURATION, a.TIMESTARTED, a.ENQUIRYID, a.LOCATION, b.TYPEDESC, c.AUTHORITYID, a.SEQUENCENO, b.ID, c.LOCATIONID
ORDER BY a.ENQUIRYID