?
Solved

Business Objects sql for previous month

Posted on 2011-10-07
2
Medium Priority
?
661 Views
Last Modified: 2013-11-15
I need assistance modifying the following SQL so it pulls the incidents that were created in the previous month.

SELECT
  SCN.INCIDENT.INCIDENT_ID,
  SCN.INCIDENT.ASSIGNMENT_GROUP,
  SCN.INCIDENT.OPEN_TIME,
  SCN.INCIDENT.UPDATE_TIME,
  SCN.INCIDENT.STATUS
FROM
  SCN.INCIDENT
WHERE
  (   SCN.INCIDENT.ASSIGNMENT_GROUP  IN  ( 'Purchasing', 'Accounting','Engineering','Fleet'  )
   AND
   SCN.INCIDENT.STATUS  IN  ( 'Pending Vendor','Open','Pending Other','Completed','Pending Customer','Work In Progress','Accepted','Waiting for Part','Referred','Part on Order','Pending Change'  )
  )

Thank you.
0
Comment
Question by:SAW56
1 Comment
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 2000 total points
ID: 36933052
Which field?  Open_Time?

to the WHERE clause add:

AND Open_Time between
  select dateadd(d, -datepart(d,getdate()) +1, DATEADD(m, -1, cast(getdate() as date)))
   and
  select dateadd(d, -datepart(d,getdate()) ,cast(getdate() as date))
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Suggested Courses

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question