I Come across below problem and not sure how to get it sorted: We have a dimensions of the boxes in database: L,W,H
As the box may be measured in random position , for example the values for Lenght may be allocated in to Height column etc. Now , we have a band for boxes which contains two conditions regarding the dimensions:
Band: Every Box with Maximum of 24x34x6 OR Every Box with Maximum of 21x21x21
To calculate this by AND , OR statements will be possible but we will end up with 100's of lines of code only for first condition as the number of combinations will be 27 and then this will need to by applied in sql statement for each of the columns H,L,W. I managed to get the total number of combinations by cross join but how to apply that to CASE statement and get reasonable performance and amount of code ?
CREATE TABLE #XMS1
( XMS1 int)
INSERT #XMS1 select 6
INSERT #XMS1 select 24
INSERT #XMS1 select 34
select
a.XMS1 as H,
b.XMS1 as L,
c.XMS1 as W
from #XMS1 as a
cross join #XMS1 b
cross join #XMS1 c
The values of L,W,H can be everyting from 0 to 100 but I need to select only the lines which fits in to the band...