?
Solved

getting a start date and end date from different rows MySQL

Posted on 2014-09-22
2
Medium Priority
?
486 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 2000 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

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…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

801 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