SQL query sample

Posted by qods on Stack Overflow See other posts from Stack Overflow or by qods
Published on 2010-06-07T15:34:55Z Indexed on 2010/06/07 15:52 UTC
Read the original article Hit count: 201

Filed under:
|

Hi, my table is look like this order.. I would like count the TermID's with these conditions; If it's possible also want to get resultset with these headers

- TermID must have close or open status
- TermID Status must turn to Open (close to open)
- Status Date (open status) must be bigger date than close status date

with my regards,


ID        TermID Status Date
103990107 103641 Close 28/05/2010
104000600 103641 Open 31/05/2010
103980976 106458 Close 26/05/2010
103990045 106458 Open 27/05/2010
103939537 106475 Open 18/05/2010
103908130 117220 Open 13/05/2010
103929653 117220 Open 13/05/2010
103999017 117360 Open 31/05/2010
103834814 117402 Open 05/05/2010
103993973 117420 Open 28/05/2010
103849795 119377 Close 05/05/2010
103955266 119377 Close 21/05/2010
103995229 119377 Close 29/05/2010
103979873 119704 Open 25/05/2010
103832225 119767 Open 04/05/2010
103925429 123229 Close 15/05/2010
103986986 123932 Open 27/05/2010

© Stack Overflow or respective owner

Related posts about sql

Related posts about query