Friday, January 19, 2018

How to Select a specific record from Employee Table without using Where Clause in SQL Server

SQL Server Query to Filter a specific record from an Employee Table without using Where Clause
Scenario:
Suppose we have an Employee Table as follows..
Select Emp_Id, NetSal From Tbl_Emp
From the above Table Tbl_Emp if we want to filter or select the details of an employee whose Emp_Id=126, we can do it using the below Query :

Select Emp_Id,Sum(NetSal) Net_Sal From Tbl_Emp 
Group By Emp_Id
Having Emp_Id=126

GO

Result :
Emp_Id Net_Sal
  126       8893

Thanks, Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.