Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kuba-re
Starting Member
2 Posts |
Posted - 2011-01-28 : 05:09:12
|
| I have following tables: partner id|name|email| - id is primary keyrole_per_partner partner_id|role_id|module_id| - partner_id and role_id are complex primary key - partner_id is foreign key that connects role_per_partner with partner table(one to many relation) - role_id is foreign key of role table (one to many relation) - module_id is foreign key of module tablemoduleid|name|desc| -id is primary key modul_taskid|module_id|.. - -id is primary key Basically, one parter can be responsible for more than one modules and module can have many_taskI need to get all the modules which belong to particular partner knowing only the module_task.id I know how to find the partner responsible for particular module_task knowing module_task.id but I do not know how to find the other modules which belong to this partner but contain this module_taskI hope you understood .. in case of doubts do not doubt to ask me questions kuba |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-01-28 : 05:27:27
|
SELECT p.Name, m.NameFROM dbo.ModuleTask AS mtINNER JOIN dbo.Module AS m ON m.ID = mt.ModuleIDINNER JOIN dbo.Partner AS p ON p.ID = m.ModuleIDWHERE mt.ID = @YourModuleTaskIdVariableValueHere N 56°04'39.26"E 12°55'05.63" |
 |
|
|
kuba-re
Starting Member
2 Posts |
Posted - 2011-01-28 : 07:57:07
|
| I managed to solve the issue. embedded the query that you posted in other query and it worked ... thx kuba |
 |
|
|
|
|
|