I have a table relevancies, where there are 2 colums. 1. User_id (It has two users, one and two) 2. Ratings
*Now I want to know the difference between ratings of two users(1,2). The rating difference should be two. *
Table:
'+--------------------------+
| Tables_in_ndcg_reporting |
+--------------------------+
| averages |
| last_visited_queries |
| products |
| queries |
| query_types |
| ratings |
| ratings_news |
| relevancies |
| schema_migrations |
| sites |
| users |
+--------------------------+
Inside relevancies:
`+-----+--------+------------+----------+---------+---------------------+---------------------+
| id | rating | product_id | query_id | user_id | created_at |updated_at
| 726 | 5 | 1 | 1 | 2 | 2016-11-24 06:06:12 | 2016-11-24 12:43:07 |
| 727 | 5 | 2 | 1 | 2 | 2016-11-24 06:06:12 | 2016-11-24 12:43:21 |
| 728 | 5 | 3 | 1 | 2 | 2016-11-24 06:06:12 | 2016-11-24 12:43:31 |
| 729 | 5 | 4 | 1 | 2 | 2016-11-24 06:06:12 | 2016-11-24 12:43:32 |
| 730 | 4 | 5 | 1 | 2 | 2016-11-24 06:06:12 | 2016-11-24 12:43:53 |
| 731 | 5 | 6 | 1 | 2 | 2016-11-24 06:06:12 | 2016-11-24 12:43:55 |
| 732 | 4 | 7 | 1 | 2 | 2016-11-24 06:06:12 | 2016-12-28 10:25:52 |
| 733 | 4 | 8 | 1 | 2 | 2016-11-24 06:06:12 | 2016-12-27 12:44:24 |
| 734 | 5 | 9 | 1 | 2 | 2016-11-24 06:06:12 | 2016-11-24 12:44:01 |
| 735 | 4 | 10 | 1 | 2 | 2016-11-24 06:06:12 | 2016-12-28 10:25:53 | `