SQL Query modification to create a tally of Result based on result of tally of last event on the same date
$30-250 AUD
Finalizat
Data postării: circa 3 ani în urmă
$30-250 AUD
Plata la predare
I have a query that captures the events that give a date and time, I group them into a related DayStartDate so some events that are on the next calendar date are classed as the previous day.
What I need to do is add a column that creates a running tally.
So on each event it looks at the previous event on the same day and returns a value of the previous Tally result in its own column and the new result in the Result Column
I have shown a cutdown version of what the SQL query shows now and what I am trying to achieve.
This is my current query and I am looking at how to modify this or how to create a new table if need be that looks at this table and create a running Tally column based on the grouped DayStartDate at each indivdual event based on the EndDate
SELECT c.*, YEAR([login to view URL]) * 10000 + MONTH([login to view URL]) * 100 + DAY([login to view URL]) AS DateID, DATEPART(hh, [login to view URL]) * 10000 + DATEPART(mi, [login to view URL]) * 100 + DATEPART(ss, [login to view URL]) AS TimeId, 42.5 AS Payload, CASE WHEN [login to view URL] != LAG([login to view URL])
OVER (ORDER BY [login to view URL], [login to view URL]) THEN CAST('00:00:00' AS time) WHEN [login to view URL] != LAG([login to view URL]) OVER (ORDER BY [login to view URL], [login to view URL]) THEN CAST('00:00:00' AS time) WHEN LAG([login to view URL]) OVER (ORDER BY [login to view URL], [login to view URL]) IS NULL
THEN CAST('00:00:00' AS time) WHEN [login to view URL] != LAG([login to view URL]) OVER (ORDER BY [login to view URL], [login to view URL]) THEN CAST('00:00:00' AS time) ELSE CAST(CONVERT(varchar(22), [login to view URL] - LAG([login to view URL]) OVER (ORDER BY [login to view URL], [login to view URL]), 114) AS time)
END AS Duration
FROM (SELECT b.*, CASE WHEN CAST([login to view URL] AS time) BETWEEN '00:00:00.000' AND '07:14:59.900' THEN CAST(CONVERT(date, [login to view URL] - 1) AS date) ELSE CAST(CAST([login to view URL] AS date) AS date) END AS DayStartDate, CASE WHEN (CAST([login to view URL] AS time) BETWEEN
'00:00:00.000' AND '07:14:59.900') OR
(CAST([login to view URL] AS time) BETWEEN '19:14:59.900' AND '23:59:59.900') THEN 1 ELSE 0 END AS ShiftNumber
FROM (SELECT [login to view URL], [login to view URL] AS EventName, [login to view URL], [login to view URL], dateadd(HH, DATEPART(TZ, [login to view URL] AT time Zone [login to view URL]) / 60, [login to view URL]) AS EndDate, [login to view URL], [login to view URL]
FROM Events e INNER JOIN
EventDefs ed ON [login to view URL] = [login to view URL] INNER JOIN
Segments s ON [login to view URL] = [login to view URL] INNER JOIN
DriversAll da ON [login to view URL] = [login to view URL] INNER JOIN
Trips t ON t .TripId = [login to view URL] INNER JOIN
VehiclesAll va ON [login to view URL] = t .VehicleId INNER JOIN
Sites si ON [login to view URL] = [login to view URL]
WHERE [login to view URL] = 1381) b) c
Dear Client.
I have read your post carefully and closely. I'm specialize in SQL qeury.
So I think that I can complete your project perfectly.
I can provide better work than you expected, I have already done a lot of work, and my clients are 100% satisfied, so I hope you enjoy working with me.
I'd be very happy to discuss this further and get started for you as soon as possible.
$160 AUD în 2 zile
5,0 (16 recenzii)
4,2
4,2
17 freelanceri plasează o ofertă medie de $160 AUD pentru proiect
Hi, Greetings!
✅ I have checked and gone through the project details and I am very skilled in it.
✅Completed Time: In project deadline
We have worked on 640 + Projects. I have 6 + years of the experience in same kind of projects. If you are looking for a true Freelancer, I am the Right person for you. I am available almost 24-7 and am very responsive. I feel proud that I am a trusted Freelancer who pleases almost every single client. You can rest assure, your work will be delivered well in advance of others, with passion and accuracy. I guarantee you instant communication & responses when you need me. Why choose me? I think every client is the reason for my success. I only take projects which I am sure I can do quickly.
My Portfolio Items: https://www.freelancer.com/u/schoudhary1553
I would really like to work with you on this project. If interested, Kindly contact me via chat for further details and discussion..
Thank you
Sandeep
Digital screencast
Hi. Hope are doing fine. I have high level expertise in SQL. I can modify the above query to get exact what you have mentioned. Will provide you top quality work for sure. I can start right now.
Hi, client.
I've read carefully your job description.
I have more than 7 years of experience in PHP, MySQL, SQL and Database Administration. In particular, I have experience in performing many of these types of tasks.
Your satisfaction with the project is my top priority!
If you give me a chance to work with you, then I will try my best level for your project to run successfully.
Best Regards Thanks!
Hello
I've seen your brief and I understood your specs of creating new table or modifying query for getting Tally rows by DayStartDate using MYSQL
I'll be able to provide you a project that will capture client's attention instantly and will be functionally sound.
I 'm looking forward to helping you grow your business by sharing my experiences.
Regards
Marko
I can efficiently assist you with required query customization because I am Senior SQL Developer having 10-plus years of professional experience and highly advanced expertise in professional SQL development.
Namaste!
Are you looking for a SQL Server Expert? If yes! You're checking the right QUOTE.
I would like to help you with the modification of SQL Query as per your business needs. It would be better to discuss the requirement over zoom meeting so that I can understand it properly.
About me: SQL Server Performance and Emergency Expert; with 6+ year of professional experience in 5 different high performance OLTP system and couple of freelancing projects. If you trust me - I will be your pain reliever and night saver in case of SQL Server Emergency.
Fair warning: Few folks outsource awarded project without the permission of their employer - so be careful while selecting a freelancer.
Warm regards,
Kundan (Your remote consultant)
Hi,
I am software engineer with SQL experience of 3+ years,
I wanted a export of your table let's build your query right away I am available to start it right now.
Looking forward to hear from you.
Thanks
Hi, there.
Do you find the method that insert or update using the result of complex join Query?
I have many experience in Database Query.
I have many example to resolve your issue.
I hope we are discussing in chat.
Thank you.
Hello, Bradley.
As a SQL expert, with over 5 years of experience in query making, I can help you.
I read your current query carefully and I understood your requirement.
I can get this done in a day.
Hope more discussion via chat.
Aleksandar.
Hello Sir/Madam,
i am interested in this project and I would like to contribute to this problem solving.
I have already been working in SQLserver and I believe I can resolve this after taking a look at the data.
A view also can be created or a Procedure to get the intended results, I will work that out.
Thanks for sharing comprehensive details of this project.
Since I am starting, I am more interested in working on this.
Thanks
Afsar Ahamed
Hi, I'm a highly skilled SQL Server Developer with over 12 years experience in designing, developing, troubleshooting, query tuning, and data migrating.
If you are interesting to have a further discussion with me, please contact me. Thanks, Hien.
i can help you on that part, As i have already done such type of task many times.
And more thing i am proficient writing sql query & managing the MSSQL database