Thursday, 15 August 2013

sql - MsSQL / Classic ASP - Select statement from time a to time b -



sql - MsSQL / Classic ASP - Select statement from time a to time b -

i have quite complex query need expand not sure how go it.

at moment, im using next query output few values.

select convert(char(8), pay.paiduntil, 10) lastday, count(*) paymentsdue, sum(sales.amount) totaldue userpaiduntil pay inner bring together sales sales on pay.sales_id = sales.sales_id pay.paiduntil > getdate() , pay.paiduntil < dateadd(day, 10, getdate()) , pay.billing_id = 2 grouping convert(char(8), pay.paiduntil, 10) order convert(char(8), pay.paiduntil, 10)

at moment, script values between 2 dates, 10 days apart , groups them date.

now need alter sql each day 10:01am on day through 10:00am on day b

the userpaiduntil.paiduntil field has dates

im not sure start thought inquire if help me.

cheers

i don't have tester statement.. :

select convert(char(8), dateadd(hour, 10, pay.paiduntil), 10) lastday, count(*) paymentsdue, sum(sales.amount) totaldue userpaiduntil pay inner bring together sales sales on pay.sales_id = sales.sales_id dateadd(hour, 10, pay.paiduntil) > getdate() , dateadd(hour, 10, pay.paiduntil) < dateadd(day, 10, getdate()) , pay.billing_id = 2 grouping convert(char(8), dateadd(hour, 10, pay.paiduntil), 10) order convert(char(8), dateadd(hour, 10, pay.paiduntil), 10)

sql sql-server asp-classic

No comments:

Post a Comment