Villarreal68
Registered User.
- Local time
- Yesterday, 22:50
- Joined
- Feb 15, 2007
- Messages
- 133
Hello everyone,
I'm working on an SQL Statment that has a month and year request, but I want to change it to request a date range.
The statment is as follows:
I would like to change what is highlighted in Red from asking for a Month and Year to ask for a date Range like BETWEEN [Begin Date] And [End Date].
How can it be acomplish? I've tried many things but nothing seems to work.
BTW this is attached to a report.
Any help is greatly appreciated.
Thanks!
I'm working on an SQL Statment that has a month and year request, but I want to change it to request a date range.
The statment is as follows:
Code:
[COLOR=red]PARAMETERS [Enter Month] Integer, [Enter Year] Integer;[/COLOR]
SELECT vWorkOrders.StatusCode AS Status, vWorkOrders.StatusDescription, vWorkOrders.SubStatusDescription, vWorkOrders.statusdate,
vWorkOrders.WONumber, vWorkOrders.WODescription AS Description, vWorkOrders.DateCreated AS [Due Date], vWorkOrders.AssetxAssetNumber AS Asset, vWorkOrders.AccountCode AS Account,
vWorkOrders.AccountDescription, vWorkOrders.CompleteDate, vCompanyData.MailName, vWorkOrders.WONumber AS CountWO, vWorkOrders.TypeCode,
vWorkOrders.skillcode
FROM vWorkOrders LEFT OUTER JOIN
vCompanyData ON vWorkOrders.IDSegment = vCompanyData.IDSegment
[COLOR=red]WHERE month(datecreated) = [Enter Month][/COLOR]
[COLOR=red]AND year(datecreated) = [Enter Year][/COLOR]
AND (vWorkOrders.TypeCode) = 'CM'
AND vworkorders.statuscode in ('CMPLT','CLOSE','ACTIV')
I would like to change what is highlighted in Red from asking for a Month and Year to ask for a date Range like BETWEEN [Begin Date] And [End Date].
How can it be acomplish? I've tried many things but nothing seems to work.
BTW this is attached to a report.
Any help is greatly appreciated.
Thanks!