Solved

getting a start date and end date from different rows MySQL

Posted on 2014-09-22
2
472 Views
Last Modified: 2014-09-22
I have a query, in that query I get the start time and a toolnumber
DROP TABLE IF EXISTS precont;
CREATE TABLE precont AS (
SELECT UploadTime as 'StartTime', ToolNumber
FROM ToolAssemblies
WHERE ControllerSn = 1024);

Open in new window

What I want is to take this:(the query above)
preresultAnd make this:(start date is the first date and the enddate is the firstdate of the next record with a new tool number
result
0
Comment
Question by:r3nder
2 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 500 total points
ID: 40337960
Hello,

try this:

select toolNumber, min(uploadtime) as startdate, max(uploadtime) as enddate

from precont

group by toolNumber
0
 
LVL 6

Author Closing Comment

by:r3nder
ID: 40338029
Thanks Samo
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now