Breaking News
recent

Where clause to a subquery in SqlServer

There are cases we want to execute a query includes a WHERE clause which must look up in a subquery and join tables is not prefferable . Find this example below.



We have a table includes the payroll of employees consist of 2 fields:

Table: EmployeesPayroll
Field 1:EmployeeId
Field 2: Amount

The query must create a list includes all employees live in London.
This is the statement

Select  EmployeeId, Amount from EmployeesPayroll 
where EmployeeId  in (SELECT Employeeid FROM Employees Where City='London')
Προμηθέας

Προμηθέας

Powered by Blogger.