Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT MAX( col )
- FROM table
- WHERE col < ( SELECT MAX( col )
- FROM table )
- --filter out the max
- select max( col )
- from [table]
- where col < (
- select max( col )
- from [table] )
- --sort top two then bottom one
- select top 1 col
- from (
- select top 2 col
- from [table]
- order by col) topTwo
- order by col desc
- select col
- from (
- select ROW_NUMBER() over (order by col asc) as 'rowNum', col
- from [table] ) withRowNum
- where rowNum = 2
- SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT 1 OFFSET 1
- SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT (1, 1)
- SELECT DISTINCT value FROM Table ORDER BY value DESC LIMIT 2
- SELECT MIN(value) FROM (SELECT DISTINCT value FROM Table ORDER BY value DESC LIMIT 2) AS t
- SELECT MIN([column]) AS [column]
- FROM (
- SELECT TOP 2 [column]
- FROM [Table]
- GROUP BY [column]
- ORDER BY [column] DESC
- ) a
- SELECT `column` FROM `table` GROUP BY `column` ORDER BY `column` DESC LIMIT 1,1
- select top 1 x
- from (
- select top 2 distinct x
- from y
- order by x desc
- ) z
- order by x
- SELECT TOP 1 START AT 2 value from table ORDER BY value
- Select * from x x1 where 1 = (select count(*) from x where x1.a < a)
- select * from emp e where 3>=(select count(distinct salary)
- from emp where s.salary<=salary)
- select top 1 MyIntColumn from MyTable
- where
- MyIntColumn <> (select top 1 MyIntColumn from MyTable order by MyIntColumn desc)
- order by MyIntColumn desc
- select max([COLUMN_NAME]) from [TABLE_NAME] where [COLUMN_NAME] <
- ( select max([COLUMN_NAME]) from [TABLE_NAME] )
- select min(sal) from emp where sal in
- (select TOP 2 (sal) from emp order by sal desc)
- select max([COLUMN_NAME]) from [TABLE_NAME] where [COLUMN_NAME] **IN**
- ( select max([COLUMN_NAME]) from [TABLE_NAME] )
- select max(COL_NAME) from TABLE_NAME where COL_NAME in
- (select COL_NAME from TABLE_NAME where COL_NAME < (select max(COL_NAME) from TABLE_NAME));
- SELECT MAX(col) FROM table WHERE col NOT IN (SELECT MAX(col) FROM table);
Add Comment
Please, Sign In to add comment