Sukesh Marla
query to get maximum amount
By Sukesh Marla in SQL Server on Aug 12 2012
  • Karthikeyan M
    Sep, 2012 18

    SELECT E1.SALARY FROM Employee E1 WHERE 2-1 = (SELECT COUNT(distinct (E2.salary)) FROM Employee E2 WHERE E2.salary < E1.salary)

    • 2
  • Suresh Bharti
    Oct, 2015 13

    HOW TO WRITE SQL QUERY 2ND HIGHEST SALARY USING SELF JOIN

    • 1
  • Neeraj Kumar
    Jul, 2013 15

    SELECT E1.SALARY FROM salary E1 WHERE 1= (SELECT COUNT(distinct (E2.salary)) FROM salary E2 WHERE E2.salary >=E1.salary)

    • 1
  • Sandeep Singh Shekhawat
    Sep, 2012 9

    SELECT E1.SALARY FROM Employee E1 WHERE 1-1 = (SELECT COUNT(distinct (E2.salary)) FROM Employee E2 WHERE E2.salary > E1.salary)

    • 1
  • Rajeev Kumar
    Jul, 2023 10

    maximum amount means simple you use MAX()
    select MAX(Amount) from tblaccount.

    • 0
  • Mohd Sohaib Jummal
    Apr, 2019 22

    Select Max(A.Amount) from tbl_Amonttable A

    • 0
  • Vikas Ahlawat
    Jul, 2014 30

    For SQL SERVER INTERVIEW QUERIES QUESTION FOLLOW THE BELOW LINKMORE THAN 100 MS SQL SERVER INTERVIEW QUERIES WITH EXAMPLEhttp://www.interviewquestionspdf.com/2014/07/sql-queries-interview-questions-answers.html

    • 0
  • Karthikeyan M
    Sep, 2012 18

    SELECT E1.SALARY FROM Employee E1 WHERE 2-1 = (SELECT COUNT(distinct (E2.salary)) FROM Employee E2 WHERE E2.salary < E1.salary)

    • 0
  • Sukesh Marla
    Aug, 2012 12

    Declare @MaxValue int
    Select @MaxValue=(case when @MaxValue>Amount then @MaxValue else Amount end) From T1
    Select @Maxvalue

    Declare @MaxValue int
    Select @MaxValue=Amount From T1 Group by Amount
    Select @MaxValue
    SELECT 
    T11.Id,
    T11.Amount as MaxAmount
    FROM T1 AS T11 left outER JOIN
    T1 AS T12 ON T11.Amount < T12.Amount 
    GROUP BY T11.Amount, T11.Id
    having COUNT(T12.Amount)=0

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS