I have 2 tables in MSSql
table_a:
data|id_1|timeInIntForm
------------------------------
data1 | 1/22323/3 | 1433721600
data2 | 1/22323/3 | 1433721660
and I have another table
table_b
data|(string list of ids)|startTimeinIntform|EndTimeInIntForm
--------------------------------------------------------------
dataA| (a_1223233_z a_1223233_x) | 1433721601 | 1433721659
datab| (a_1223233_z a_1223233_x) | 1433721602 | 1433721645
I want to do a
select * from table_a where id_1 = 'someId'
and timeInIntForm between 'time1' and 'time2'
and not between TableB_row1[startTimeinIntform] and TableB_row1[EndTimeInIntForm]'
.
.
.
and not between TableB_rowN[startTimeinIntform] and TableB_rowN[EndTimeInIntForm]'
The ids do not match but can be correlated on a different table that has
table_c:
data|id_1|id_2
-----------------------------
data| 1/22323/3 | a_1223233_z
data| 1/22323/4 | a_1223233_x
my initial thought is in PHP to get the rows from table_b and then as I select from table_a build the not between clause from each row in table_b. But I would LOVE to do this in one select statement if possible. Any ideas?
I edited it to have some "sample" data I was asked for. I am stumped on how to join these .. I admit freely I am not a pro or even poor at joins but I am really stumped on how to join table b to a and c