Solved

getting a start date and end date from different rows MySQL

Posted on 2014-09-22
2
481 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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