Dear All,
I am using a SQL server database with around 20 columns,all the columns have numeric values, I want to write an SQL statement which does the following:
compare each row of the table with all other rows in the table and return all the rows that have a difference of + or - 0.5 in each column, for eg if row1 has values 12.2,13.6,11.4,15.7 corresponding to column1,2,3,4 the sql statement should return all the rows from the table with values of column 1-4 between
12.2- 0.5 to 12.2 + 0.5
13.6 -0.5 to 13.6+ 0.5
11.4 -0.5 to 11.4 +0.5
15.7 -0.5 to 15.7 +0.5
Could anyone suggest how i go about doing this.
thank you in advance
harsha
I am using a SQL server database with around 20 columns,all the columns have numeric values, I want to write an SQL statement which does the following:
compare each row of the table with all other rows in the table and return all the rows that have a difference of + or - 0.5 in each column, for eg if row1 has values 12.2,13.6,11.4,15.7 corresponding to column1,2,3,4 the sql statement should return all the rows from the table with values of column 1-4 between
12.2- 0.5 to 12.2 + 0.5
13.6 -0.5 to 13.6+ 0.5
11.4 -0.5 to 11.4 +0.5
15.7 -0.5 to 15.7 +0.5
Could anyone suggest how i go about doing this.
thank you in advance
harsha