10 pts.
 How to make a single row in SQL
Dear all, Please help me I am not good in sql queries. I have a view like this. SNo Employee title Cdate IN TIME OUT TIME 258 john accountant 27/01/2008 7:28:12 258 john accountant 27/01/2008 7:28:30 258 john accountant 27/01/2008 16:03:42 258 john accountant 27/01/2008 16:03:48 258 john accountant 28/01/2008 7:36:42 258 john accountant 28/01/2008 7:36:51 258 john accountant 28/01/2008 16:05:24 258 john accountant 28/01/2008 16:05:30 Now i need to solve the following problem to find the min(time) for a particular date and max of the same date and as a single raw for th particular date as below staffNo Employee title Cdate IN TIME OUT TIME 258 john accountant 27/01/2008 7:28:12 16:03:48

Software/Hardware used:
ASKED: February 20, 2008  6:31 AM
UPDATED: February 20, 2008  1:21 PM

Answer Wiki:
That's done by putting a MIN() and MAX() in the SELECT statement. <pre>SELECT SNo, Employee, Title, cdate, MIN(TimeColumn) MinTime, MAX(TimeColumn) MaxTime FROM YourView GROUP BY SNo, Employee, Title, cdate</pre>
Last Wiki Answer Submitted:  February 20, 2008  8:01 am  by  Denny Cherry   64,520 pts.
All Answer Wiki Contributors:  Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.

 64,520 pts.