How to make a single row in SQL

10 pts.
Tags:
Query
SQL
SQL Query
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

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>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following