Avatar of sukhoi35

asked on 

Suggestions for writing a query

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
DatabasesMicrosoft SQL ServerSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon