![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
From tbl_employee Where employee_id in ( |
#2
| |||
| |||
|
|
Hello experts, I'm trying the run the following query with specific intentions. I would like the query to return 5 results; i.e., 4 distinct and one duplicate. I am only getting, however, 4 distinct records. I would like the results from the '007' id to spit out twice. I'm not using 'distinct,' and I've tried 'all.' I realize that I could put my 5 employee id's in a table and do a left or right join; I would like to avoid that, however. Any thoughts? Select Employee_last_name, Employee_first_name From tbl_employee Where employee_id in ( '009', '008', '007', '007', '006' ); alex |
#3
| |||
| |||
|
|
I would like the query to return 5 results; i.e., 4 distinct and one duplicate. |
#4
| |||
| |||
|
|
I would like the query to return 5 results; i.e., 4 distinct and one duplicate. The easy way is a UNION, based on a guess about the DDL you did bother to post and the uniquness of emp_id: SELECT last_name, first_name FROM Personnel WHERE emp_id IN ('009', '008', '007', '006') UNION SELECT last_name, first_name FROM Personnel WHERE emp_id = '007' |
![]() |
| Thread Tools | |
| Display Modes | |
| |