Select all rows that have column value larger than some value

mysql, select, sql

Solution

Yes it is possible.

SELECT * FROM MyTable 
WHERE rank > (SELECT Rank FROM MyTable WHERE username = 'e')

or you can also use `self-join` for the same

SELECT t1.* FROM MyTable t1
  JOIN MyTable t2
    ON t1.Rank > t2.Rank
   AND t2.username = 'e';

See this SQLFiddle

Problem

I have a SQL table thus: ``` username | rank a | 0 b | 2 c | 5 d | 4 e | 5 f | 7 g | 1 h | 12 ``` I want to use a single select statement that returns all rows that have rank greater than the value of user e's rank. Is this possible with a single statement?

Original source