Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with dates

Author  Topic 

ayamas
Aged Yak Warrior

552 Posts

Posted - 2007-04-09 : 01:30:16
Hi to all the SQL Gurus,

I have a table where dates are stored in single column.Actually the application is a leave application where the the dates
taken by an employee is saved.The format is like this

Pid dates
7 12/05/2007
7 13/05/2007
7 14/05/2007
7 15/05/2007
8 10/06/2007
8 11/06/2007 and so on
What I want is that at the front end the data should be displayed in the form of

From date To Date
12/05/2007 15/05/2007 for Pid 7

10/06/2007 11/06/2007 for Pid 8 & so on

Any ideas on how to acheive it?


Regards,
Sachin

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-09 : 01:36:37
[code]
select Pid, min(dates), max(dates)
from yourtable
group by Pid
[/code]


KH

Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2007-04-09 : 02:26:23
Man that was fast.
Hats of to you khtan.
Thanks
Go to Top of Page
   

- Advertisement -