Discussion Locked

Report By Date range, Grouped into days

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am creating a Stored Procedure to query between a given date range as follows:

SELECT
Ksnr as 'Cust No', Artnr as 'Intier No', count(*) as Quantity

FROM
JITWork_Archiv

WHERE
(NOT (Sequenznr LIKE '0%')) AND (Letzte_Prioritaet = 11) AND (Zeitstempel BETWEEN CONVERT(DATETIME, @StartDate, 102) AND CONVERT(DATETIME, @EndDate, 102)) and (NOT( Artnr LIKE 'Dummy'))
Group by Ksnr, Artnr

This works 100%, however I need the result to be by day between 21:40:00 hours and 21:39:59 hours. for a month(Given within the query).

Can someone help?

Thanks

Brian

2 replies

by tony hopkinson

There are shortcuts implemented by some dbms's as well such as Hour() and Month() DayOfWeek() etc.

PS NOT (artnr LIKE 'Dummy') no wild cards in it ?

This discussion is closed to new replies.