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 |
|
Jemy
Starting Member
3 Posts |
Posted - 2012-05-20 : 11:33:14
|
| Dear All,I have a table of 'items' containing user codes who created and updated items. i need to pick the names in place of user codes from another table called users. Please help me in doing the same.Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-20 : 12:00:05
|
| just a simple inner join with user table on usercodes will do the trick for you------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Jemy
Starting Member
3 Posts |
Posted - 2012-05-21 : 01:54:19
|
Dear Vishak,Sorry for disturbing you again.I have the following tables.Table1 – oitmItemcode itemname usersign usersign2Da8503 hose 1 12Table2 – ousrUserid u_name1 manager2 rajeshI need to pick the table1 information with user names in place of user idWhile inner join the following error message is getting.‘The objects "oitm" and "oitm" in the FROM clause have the same exposed names. Use correlation names to distinguish them.’Hope you got it.Thanksquote: Originally posted by visakh16 just a simple inner join with user table on usercodes will do the trick for you------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-21 : 16:05:15
|
| [code]SELECT o.Itemcode, o.itemname,u1.u_name AS usersign,u2.u_name AS usersign2FROM oitm oINNER JOIN ousr u1ON u1.Userid = o.usersign INNER JOIN ousr u2ON u2.Userid = o.usersign2[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Jemy
Starting Member
3 Posts |
Posted - 2012-05-22 : 11:00:45
|
Yes it is working.Thank you vishak. Thank you very muchJemyquote: Originally posted by visakh16
SELECT o.Itemcode, o.itemname,u1.u_name AS usersign,u2.u_name AS usersign2FROM oitm oINNER JOIN ousr u1ON u1.Userid = o.usersign INNER JOIN ousr u2ON u2.Userid = o.usersign2 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-23 : 15:47:10
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|