Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql select students closest in score

SELECT 
    s1.student AS one_student
    , s2.student AS other_student
    , ABS(s1.score - s2.score) AS score_diff
FROM scores AS s1
INNER JOIN scores AS s2
    ON s1.id != s2.id
        AND s1.id < s2.id
ORDER BY 3 ASC, 1 ASC
LIMIT 1
Comment

PREVIOUS NEXT
Code Example
Sql :: like date sql server not working 
Sql :: how to write query to to display record having maximum value 
Sql :: ring MySQL Save Image inside the database 
Sql :: postgres grep entire database 
Sql :: MQL4 mql4 run ea on all symbols by adding to just one chart 
Sql :: drop check command 
Sql :: check the size of the tables here ordered from the biggest size 
Sql :: table values functions in SQL 
Sql :: fast sql column count 
Sql :: employee name starting with in sql 
Sql :: SQL Cut part string 
Sql :: ksqldb limit pull query ksql kafka 
Sql :: sql 2year 
Sql :: mysql utc to toronto time 
Sql :: group function in sql 
Sql :: subquery 
Sql :: find below average salary in sql 
Sql :: max in postgresql 
Sql :: sql script to delete duplicate records in a table 
Sql :: mysql stand for 
Sql :: sqlFunction does not exist 
Csharp :: c# messagebox yes no 
Csharp :: split on uppercase c# 
Csharp :: c# get user directory 
Csharp :: simple reset transform.rotation c# 
Csharp :: unity ray from mouse position 
Csharp :: kotlin random number 
Csharp :: c# windows grab screenshot 
Csharp :: c# open file dialog 
Csharp :: c# convert dictionary to anonymous object 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =