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 |
|
jasmin
Starting Member
1 Post |
Posted - 2008-07-28 : 09:49:21
|
| Hi there!I am new on SQL. I have been training on for a month. I have given a question by my boss to test me. Could you please help me for this? There is a table like below,Eleman_Id Eleman_Ad Mudur_Id5 Faruk SARI 2010 Selma ACAR 3515 Ali KUCUK 3520 Mehmet CICEK 4525 Fatma FIRAT 2030 Ahmet AK 2035 Emine GUVEN 4540 Salim GUVEN 2045 Veli INCE 50 Ayse OZ 35I need to get the below resultMudur AD Eleman_AdEmine GUVEN Selma ACAREmine GUVEN Ali KUCUKEmine GUVEN Ayse OZMehmet CICEK Faruk SARIMehmet CICEK Fatma FIRATMehmet CICEK Ahmet AKMehmet CICEK Salim GUVENVeli INCE Mehmet CICEKVeli INCE Emine GUVENYOK Veli INCEthanks in advance |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-07-28 : 09:51:46
|
| you need to write the query so it joins the table to itself on eleman_id = mudur_idshow us what you tried so farEm |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-28 : 09:59:22
|
quote: Originally posted by jasmin Hi there!I am new on SQL. I have been training on for a month. I have given a question by my boss to test me. Could you please help me for this? There is a table like below,Eleman_Id Eleman_Ad Mudur_Id5 Faruk SARI 2010 Selma ACAR 3515 Ali KUCUK 3520 Mehmet CICEK 4525 Fatma FIRAT 2030 Ahmet AK 2035 Emine GUVEN 4540 Salim GUVEN 2045 Veli INCE 50 Ayse OZ 35I need to get the below resultMudur AD Eleman_AdEmine GUVEN Selma ACAREmine GUVEN Ali KUCUKEmine GUVEN Ayse OZMehmet CICEK Faruk SARIMehmet CICEK Fatma FIRATMehmet CICEK Ahmet AKMehmet CICEK Salim GUVENVeli INCE Mehmet CICEKVeli INCE Emine GUVENYOK Veli INCEthanks in advance
the clue is you should take a self join i.e join your table with itself to retrive the expected result. the relationship is defined by column Eleman_Id & Mudur_Id. Now try it and post back if you face any problems. |
 |
|
|
|
|
|