on 02-25-2019 11:37 AM
Hi Marcin,
You should create an Alias of mszpot_staffs, and name it as (probably) mszpot_mgrs, and create join as below, and check Outer join on msgpot_staffs table.
mszpot_mgrs.staff_id = mszpot_staffs.staff_id.
Thanks,
Mahboob Mohammed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's look correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marcin,
Actually, Self Join (Self Restricting Join) is a term used in IDT in a different way. If you want to filter a column in a table in the Data Foundation Layer, check out the details of Self Restricting Join in this page.
Apart from that, not just in IDT or UDT, even when you write free hand sql in a database client tool like Toad or SQL Developer or SQL Server Management Studio, when you want to use a table for 2 different purposes (and you want to join it to itself), you'll have to create an Alias, and this Employee and Manager relation is a classic example.
In IDT you create an Alias using the GUI feature, but when you write SQL, you need to write the SQL as below, where mgr is an alias of emp table, created during runtime, and empid of alias table is joined to mgrid of emp table. The alias table MGR is used to get info about an Employee's Manager. Hope that helps.
select emp.name, mgr.name
from emp
left join emp mgr on (emp.mgrid = mgr.empid)
Thanks,
Mahboob Mohammed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marcin,
If an answer has helped you, please mark it as Accepted, for 2 reasons. 1. It separates Unanswered and Answered questions, which'll help people. 2. I'll get points for it.
Thanks,
Mahboob Mohammed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.