Find Jobs
Hire Freelancers

SQL Query modification to create a tally of Result based on result of tally of last event on the same date

$30-250 AUD

Completed
Posted over 3 years ago

$30-250 AUD

Paid on delivery
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
Project ID: 29321760

About the project

17 proposals
Remote project
Active 3 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
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 in 2 days
5.0 (16 reviews)
4.2
4.2
17 freelancers are bidding on average $160 AUD for this job
User Avatar
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
$180 AUD in 3 days
4.9 (109 reviews)
7.1
7.1
User Avatar
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.
$100 AUD in 2 days
5.0 (81 reviews)
5.9
5.9
User Avatar
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!
$150 AUD in 7 days
5.0 (16 reviews)
5.7
5.7
User Avatar
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
$200 AUD in 1 day
4.9 (26 reviews)
5.7
5.7
User Avatar
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.
$200 AUD in 3 days
5.0 (51 reviews)
5.4
5.4
User Avatar
Hello I have rich experience in SQL Development. Please contact me. I can finish in short time. Oksana.
$140 AUD in 7 days
4.8 (22 reviews)
5.0
5.0
User Avatar
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)
$180 AUD in 3 days
5.0 (17 reviews)
4.6
4.6
User Avatar
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
$90 AUD in 3 days
5.0 (5 reviews)
2.9
2.9
User Avatar
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.
$140 AUD in 7 days
5.0 (2 reviews)
0.4
0.4
User Avatar
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.
$250 AUD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
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
$100 AUD in 7 days
0.0 (0 reviews)
0.0
0.0
User Avatar
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.
$111 AUD in 2 days
0.0 (0 reviews)
0.0
0.0
User Avatar
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
$240 AUD in 6 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of AUSTRALIA
hamilton, Australia
4.9
8
Payment method verified
Member since Apr 25, 2016

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.