Click here to Skip to main content
15,879,490 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to count the no. of HOLD entry between the Two ACTIVE entry.
Eg.

S.NO ____ DATA ______ STATUS
___1 _______ B _________ active
___2 _______ D _________ hold
___3 _______ C _________ active
___4 _______ H _________ hold\
___5 _______ j __________ hold
___6 _______ k _________ hold
___7 _______ l __________ hold
___8 _______ y _________ active

so the code output of the following tables comes

COUNT OF HOLD
-------------
2



Means when HOLD entry comes between two ACTIVE entry we take it as a batch of HOLD entry.
Then we Count the whole Batch of HOLD entry in the table. In the above Eg. the same things is i have done, there is one hold entry between two active this is count to be 1.
then another 4 HOLD entry between another two ACTIVE this is count to be 1.
so there are two counts are there 1+1.
so this is O/P
Posted
Comments
Jörgen Andersson 24-Feb-14 7:16am    
Is the S.NO contiguous or can there be gaps in the sequence?
Can there be any other statuses besides active and hold?
S.P.Tiwari 25-Feb-14 10:13am    
hi, is it possible consicutive "active" records. i mean ->

Active
Hold
Active
Active

--?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900