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 |
|
Medea
Starting Member
1 Post |
Posted - 2006-07-26 : 07:07:58
|
| Hello,this is my first post on this gerat forum. I would like to show some relationships between my customers.I have customers, whose are partners of me. With my SQL query I would like to show this relationship. The data model looks like this.Customer-id-name-person_idPerson_relationship-id-person_id_person_rel_id_person_rel_function_idperson-id-name-adress_idfunction-id-title (manager,partner e.g.)I would like to show some kind of relationshipcustomer.person_id->person_relationship_person_id to get all my partners with the person_function_id and then their managers, if they have some.I did it with a UNION SQL query but the issue was terrible.Could anyone help me with this SQL query.The result should contain my partner and his/her manager.Thanks for your help.Best regards Medea |
|
|
Q
Yak Posting Veteran
76 Posts |
Posted - 2006-07-26 : 07:31:15
|
| from customer inner join Person_relationship on customer.person_id = person_relationship.person_idthis will lin the 2 tables. Hopefully you can fill in the rest... |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-07-26 : 09:06:31
|
| you need to learns on JOINS and TYPES OF JOINsThis will help you do any kind of query from the differnt tables.Chirag |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|