SAMPLE 3 For 9473718

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

WITH A As (
SELECT 1 as ID, 100 rank , 'Name1' as Name
UNION SELECT 1,    45,  'Name2'
UNION SELECT 2,    60,  'Name3'
UNION SELECT 2,    42,  'Name4'
UNION SELECT 2,    88,  'Name5' )
, B AS (
SELECT 1 as ID, 'fn1' as FileName
UNION SELECT 2  , 'fn2')

SELECT a1.ID, a2.rank
FROM a a1
LEFT JOIN a a2
  ON a2.id = a1.id
  AND a2.rank > a1.rank
WHERE a2.id IS NULL

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results