Hi...
I have this small four tables
people People_Department Department nac
ionality
-peopleID -People -DepartmentID
-nacionID
-NamePeople -Department -NameDepartment -nameNa
cion
-NacionPeople
and my stored procedure is this..
select NamePeople, NameDepartment, namenacion from people
inner join nacionality on Nacion_People=nacionID
inner join People_Department on peopleID = People
iinner join Department on DepartmentID = Department
Only i obtain a row of result, and in the table People Department i have a p
erson that works in two departments...
i need this kind of result:
Name Department
-- --
Peter Financial
Peter Computers
but i only obtain, if i search for peter:
Name Department
-- --
Peter Financial
Thanks in advance.
Josema.I'd check the data and the constraints. I have some tables in a database of
mine that have similar relationships (2 tables with a domain relationship,
one of which is connected through a linking table to another table) and it
works just fine. Here was my query with the following tables:
tb_clarify_repl = people
tb_facility_info = nacionality
tb_pkg_audit_rollup = People_Department
tb_pkg_info = department
select t.machine_name, i.pkg_name, f.facility_name
from tb_clarify_repl t inner join tb_facility_info f
on t.facility_id = f.facility_id
inner join tb_pkg_audit_rollup r
on t.machine_id = r.machine_id
inner join tb_pkg_info i
on r.pkg_id = i.pkg_id
Check the data and the relationships and make sure they are what you think.
I think what you have should work.
Christian Smith
"josema" <anonymous@.discussions.microsoft.com> wrote in message
news:0ACCF892-FA22-4ACF-8189-79CAE6F586A5@.microsoft.com...
> Hi...
> I have this small four tables
> people People_Department Department
nacionality
> -peopleID -People -DepartmentID
-nacionID
> -NamePeople -Department -NameDepartment -na
meNacion
> -NacionPeople
> and my stored procedure is this..
> select NamePeople, NameDepartment, namenacion from people
> inner join nacionality on Nacion_People=nacionID
> inner join People_Department on peopleID = People
> iinner join Department on DepartmentID = Department
> Only i obtain a row of result, and in the table People Department i have a
person that works in two departments...
> i need this kind of result:
> Name Department
> -- --
> Peter Financial
> Peter Computers
> but i only obtain, if i search for peter:
> Name Department
> -- --
> Peter Financial
>
> Thanks in advance.
> Josema.
>|||thanks Cristian i was wrong. Your example was very useful...
Kind Regards.
Josema.
Showing posts with label tablespeople. Show all posts
Showing posts with label tablespeople. Show all posts
Wednesday, March 28, 2012
Subscribe to:
Posts (Atom)