更新时间:2022-12-13 08:07:02
Employee_NO = 1和Employee_NO = 2
这将要求每一行同时匹配(Employee_NO = 1)AND(Employee_NO = 2)。
你有几个选择:- n> 简单版本,编号必须为1或2
WHERE (Employee_NO = 1 )
OR (Employee_NO = 2 )
- 返回一系列结果。 ID是连续的好
WHERE Employee_NO BETWEEN 1 AND 2
- 这将返回基于ID的多个结果,也可以使用子查询填充
WHERE Employee_NO IN ( 1 , 2 跨度>)
I have a table,
Employee_Name Employee_ID Employee_NO
BEN 1235 1
PHILLIP 1234 1
DAVID 1245 2
ALEX 1248 2
ALICIA 1247 3
I would like to get this output as
Employee_Name Employee_ID Employee_NO
BEN 1235 1
PHILLIP 1234 1
DAVID 1245 2
ALEX 1248 2
Please LET ME KNOW THE QUERY
What I have tried:
i have tried
Select * from Employee where Employee_NO = 1 and Employee_NO = 2, but not getting the output.
Employee_NO = 1 and Employee_NO = 2
This would require each row to match both (Employee_NO = 1) AND (Employee_NO = 2) simultaneously.
You have a few options:-- the simple version, number must be 1 or 2 WHERE (Employee_NO = 1) OR (Employee_NO = 2) -- This returns a range of results. Good if IDs are contiguous WHERE Employee_NO BETWEEN 1 AND 2 -- This returns multiple results based on ID, can be populated with a sub-query as well WHERE Employee_NO IN (1, 2)