c# - SQL CROSS JOIN question -
i having bit of trouble sql query.
i have 2 tables:
table1
id guid title d0 d1 d2 ----------------------------------------- 1 guid1 title1 0.123 -0.235 0.789 2 guid2 title2 -0.343 0.435 0.459 3 guid3 title3 0.243 -0.267 -0.934 ... 100 guid4 title100 -0.423 0.955 0.029
and table 2 (note has same schema, different data).
id guid title d0 d1 d2 ---------------------------------------- 1 guid1 title1 0.233 -0.436 -0.389 2 guid2 title2 -0.343 0.235 0.789 3 guid3 title3 0.573 -0.067 -0.124 ... 100 guid4 title100 -0.343 0.155 0.005
i trying figure out how write select
statement returns titles where
combinations of abs(table1_d0*table2_d0)+abs(table1_d1*table2_d1)+abs(table1_d2*table2_d2)
less thresholded value (hard coded probably).
so far trying use cross join
, not sure if correct approach.
does make sense? table1, row1 against rows of table2, table1, row2 against rows of table2.
if matters, using ms sql.
many thanks! brett
select t1.title table1 t1 cross join table2 t2 abs(t1.d0*t2.d0)+abs(t1.d1*t2.d1)+abs(t1.d2*t2.d2)<10
Comments
Post a Comment