THE SQL Server Blog Spot on the Web
Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

well, its related a simple sql query

Last post 07-02-2008, 13:51 by Peter DeBetta. 1 replies.
Sort Posts: Previous Next
  •  06-30-2008, 13:06 7578

    well, its related a simple sql query

    Its a query related to the demo employee table from oracle database.
    The query is----------------------
    Write a select statement which will display the details of all the employees and print a * mark against the employee getting the maximum salary ,where the * mark will be displayed alongside its salary column.
  •  07-02-2008, 13:51 7625 in reply to 7578

    Re: well, its related a simple sql query

    This would be one way to do it.

    SELECT [EmployeeID],
          
    [LastName],
          
    [FirstName],
          
    [Title],
          
    [HireDate],
          
    [Salary],
           
    CASE WHEN [Salary] (SELECT MAX([Salary]FROM [EmployeesInfo]THEN '*' ELSE '' END AS [MaxSalary]
    FROM [EmployeesInfo]

Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement