cancel
Showing results for 
Search instead for 
Did you mean: 

Query to report no. of days at stage 1 sales opportunity

former_member459477
Participant
0 Kudos

I want to write query which returns list of Sales opportunities between 2 inut dates - result must include number of days between date of stage 1 (enquiry stage) and date of Stage 2 (quotation stage)

Is this possible using DateDiff() function? How can I get date of stages?

Karen

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try this first:

SELECT T1.[OpprId], T1.[Name], T1.[OpenDate], T1.[CloseDate], 
datediff(dd,T1.[OpenDate],T1.[CloseDate]) '# of days'
FROM OOPR T1
WHERE  T1.[OpenDate] > [%0] AND T1.[CloseDate] < [%1]

Thanks,

Gordon

msundararaja_perumal
Active Contributor
0 Kudos

Hi Andrew,

Try to use the below query for your further modification


SELECT T1.[OpprId], T1.[Name], T0.[OpenDate], T0.[CloseDate], 
datediff(dd,T0.[OpenDate],T0.[CloseDate]),
T2.[Descript] FROM OPR1 T0  INNER JOIN OOPR T1 ON T0.OpprId = T1.OpprId INNER JOIN OOST T2 ON T0.Step_Id = T2.Num