[Solved] SQL where clause two seperate values? [closed]

You have to join the the employee table twice: select distinct employee.LastName, employee.EmployeeId, manager.Lastname from customer join employee as employee on customer.SupportRepId = employee.EmployeeId join employee as manager on employee.ReportsTo = manager.employeeId where customer.Country = ‘Canada’ 0 solved SQL where clause two seperate values? [closed]

[Solved] Is a date within some of periods [closed]

This function should do what you want. It relies on MySQL treating boolean results as either 1 or 0 in a numeric context, thus the MAX call effectively becomes an OR of all the conditions. CREATE FUNCTION check_activity(project_id INT, check_date DATE) RETURNS BOOLEAN DETERMINISTIC BEGIN RETURN (SELECT MAX(check_date BETWEEN ActiveFrom AND ActiveTo) FROM projects WHERE … Read more

[Solved] Find out the Employees who were absent for 3 consecutive days [closed]

SELECT DISTINCT A.EMPLOYEENAME FROM Attendance AS A JOIN Attendance AS B ON B.LEAVE_DATE = A.LEAVE_DATE + 1 AND B.EMPLOYEENAME = A.EMPLOYEENAME JOIN Attendance AS C ON C.LEAVE_DATE = B.LEAVE_DATE + 1 AND C.EMPLOYEENAME = B.EMPLOYEENAME The inner joins will remove all employee who were not absent three consecutive days. 14 solved Find out the Employees … Read more

[Solved] Selecting distinct values from multiple column of a table with their count

Get all column values to one row and find the count SQL SERVER ;WITH CTE AS ( SELECT COL1 Name FROM YOURTABLE UNION ALL SELECT COL2 FROM YOURTABLE UNION ALL SELECT COL3 FROM YOURTABLE UNION ALL SELECT COL4 FROM YOURTABLE UNION ALL SELECT COL6 FROM YOURTABLE UNION ALL SELECT COL7 FROM YOURTABLE ) SELECT DISTINCT … Read more