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 |
|
ErwinB
Starting Member
2 Posts |
Posted - 2009-08-22 : 16:54:31
|
| Hi,I've been messing around for a while now, but my SQL skills are more rusty than I thought and Google-searches didn't help me any further, so I hope some SQL guru can help me.The (simplified) situation:Table A with fields Name, ScoreTable B with fields ScoreRangeLow, ScoreRangeHigh, ScoreDescriptionI want to create a select statement that displays Name, Score, ScoreDescriptionwhere the latter comes from the record in table B where the Score is between the ScoreRangeLow and ScoreRangeHigh.Example:Table A has a record "Jim, 75"Table B has a record "60, 80, Pretty Good"So the result should be "Jim, 75, Pretty Good".Your help is much appreciated.Erwin |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2009-08-23 : 02:09:23
|
| select name,score, scoredescriptionfrom tableA a inner join tableb b on a.score between ScoreRangeLow and ScoreRangeHighif that doesn't work change between to >= and <= |
 |
|
|
ErwinB
Starting Member
2 Posts |
Posted - 2009-08-23 : 11:59:50
|
| Thanks LoztInSpace !Turns out I was close, but missed the table alias. Your SQL statement works like charm. |
 |
|
|
|
|
|
|
|