Hamster
Resident Rodent
- Joined
- Aug 22, 2006
- Messages
- 45,908
- Reaction score
- 18,407
select car.*, null, null from car where carID not in deptRef table and carID not in empRef table
union
select car.*, deptRef.deptName, "Department" from car inner join the deptRef and dept tables
union
select car.*, empRef.empName, "Employee" from car inner join the empRef and emp tables
You can map that with Dapper. Although depending on the size of those tables it might not be the most efficient query (or the best approach). Maybe using case statements will be better. Meh.
union
select car.*, deptRef.deptName, "Department" from car inner join the deptRef and dept tables
union
select car.*, empRef.empName, "Employee" from car inner join the empRef and emp tables
You can map that with Dapper. Although depending on the size of those tables it might not be the most efficient query (or the best approach). Maybe using case statements will be better. Meh.