Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Vedder
Starting Member
8 Posts |
Posted - 2004-08-27 : 22:00:15
|
| have two tables in a sql server 2000 database. Table1------FromWeight (real)ToWeight (real)Penalty (int)Table2------ID (int)Weight (real)What's the best way of selecting FromWeight, ToWeight and Penalty based on the Weight value of the second table?Example Data:FromWeight ToWeight Penalty10 20 1220 26 15ID Weight1 162 223 18so my select would return1 (id),16 (weight), 12 (penalty) for first entry in ID/Weight table.Thanks in advance |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-08-27 : 22:33:01
|
| SELECT t1.FromWeight, t1.ToWeight, t1.Penalty, t2.ID, t2.WeightFROM Table1 t1INNER JOIN Table2 t2 ON t2.Weight BETWEEN t1.FromWeight AND t1.ToWeightMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Vedder
Starting Member
8 Posts |
Posted - 2004-08-27 : 22:45:16
|
| That's great. Thanks. Much appreciated. |
 |
|
|
|
|
|