-1

I have one table : SCORE

name score
mike 97
tom  86
lucy 44

and another table : RANK

low up rank
90 100 A 
80 90 B
70 80 C
60 70 D
0 60 E

and I want the result like that

name score rank 
mike 97     A
tom  86     B
lucy 44     E

How to write sql

Shakeer Mirza
  • 5,054
  • 2
  • 18
  • 41
jaymie
  • 53
  • 3
  • 1
    Do a JOIN. Check value between low and up as condition. – jarlh Jan 17 '17 at 07:59
  • To give you a great answer, it might help us if you have a glance at [ask] if you haven't already. It might be also useful if you could provide a [mcve]. And please use a search engine of your choice before asking questions. – Mat Jan 17 '17 at 10:18
  • Possible duplicate of [sql join two table](http://stackoverflow.com/questions/9171963/sql-join-two-table) – Mat Jan 17 '17 at 10:23

1 Answers1

0

Try the below query, JOIN two table with condition of rank between low and up

SELECT name,score,rank
FROM    score
    JOIN rank ON score > low AND score<=up
Abdul Rasheed
  • 6,486
  • 4
  • 32
  • 48