troubleshooting Question

Suggestions for writing a query

Avatar of sukhoi35
sukhoi35 asked on
DatabasesMicrosoft SQL ServerSQL
18 Comments3 Solutions163 ViewsLast Modified:
Hello Experts,
Need your suggestion please as my knowledge with SQL is basic. I have a table having several thousands of rows. Each set of rows have a common id for example, the first 1000 rows belong to dataset no. 1 and so all have value 1 in the id column. Within these 1000 rows, I need to find the calculation of multiple two rows having same time stamp and compare with another row having similar time stamp.

For example, pick the value contained in the row having field X and pick the value contained in the row having field y, divide them and compare it with the value in the row z by display it as output similar to the columns below. I am not sure if Joins would be the right way as they are all part of the same table.


id | X Value | Y Value | Division Result | Z Value | Time Stamp
1         20                 10                        2                     2              23:59:59
SOLUTION
Olaf Doschke
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros