SQL- Find Min And Max date based group by Unit and Type

48 views
Skip to first unread message

crazy

unread,
Mar 22, 2014, 11:22:06 AM3/22/14
to DotNetDe...@googlegroups.com
Dear All,

I want to group the Min and MAx of date  based on number  of unit as below,please help



 

My current Data

DayDate

NoOfUnit

Type

1-Apr-14

1

A

2-Apr-14

1

A

3-Apr-14

1

A

4-Apr-14

1

A

5-Apr-14

0

A

6-Apr-14

2

A

7-Apr-14

2

A

8-Apr-14

0

A

9-Apr-14

1

A

10-Apr-14

0

A

11-Apr-14

1

A

12-Apr-14

1

A

14-Apr-14

1

A

 

 

Expected Result

From Date

ToDate

NoOfUnit

Type

1-Apr-14

4-Apr-14

1

A

6-Apr-14

7-Apr-14

2

A

9-Apr-14

9-Apr-14

1

A

11-Apr-14

14-Apr-14

1

A

 

 

Thanks in advance..



--
"People who never make mistakes, never do anything."

dEv
Reply all
Reply to author
Forward
0 new messages