How to check if there exist only one record for a certain Id
I have two tables called Tbl_Company
and Tbl_Employee
I am fetching employees as follows-
SELECT DISTINCT emp.employee_id
FROM Tbl_Company comp
, Tbl_Employee emp
WHERE
emp.company_id = comp.company_id
AND emp.company_id = 1234;
This query returns exactly one value. How can I make sure that above query returns exacly one value for any comany_id I enter.
I tried using solutions given in This post with no success. Is there any simpler way to do this.
I have solved this by using ans by
@davegreen100
in commentThis will give me the count of employees per company