View Single Post
 10-11-2012, 01:30 AM PM User | #5 Old Pedant Supreme Master coder!     Join Date: Feb 2009 Posts: 24,962 Thanks: 75 Thanked 4,309 Times in 4,276 Posts As GuelphDad said, KILL the LIKE conditions. But as to how to get a "closest match": That's not too hard, but YOU have to define the meaning of "closest". Let's say that we are looking for Code: ```L D H 100 50 30``` Which of these is *closest* to that? Code: ```L D H 101 80 50 110 60 20``` According to your definition of "closest"? Clearly a 101 length is very close to your requested 100 length. But the OVERALL differences in the second choice might lead you to choose it. So do you choose based on the closest match on any dimension? Do you choose based on the SUM of the differences? Or do you choose based on the PRODUCT of the three values (that is, the volume of the object)? It's tempting to go with VOLUME until you realize that, for your requested 100x50x30 (150000 volume), you would get a perfect match from (for example) 150000x1x1 SO...*YOU* have to choose the "closest" algorithm to use and THEN we can help you implement it in SQL code. __________________ An optimist sees the glass as half full. A pessimist sees the glass as half empty. A realist drinks it no matter how much there is.