Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help to build a query
Message
 
 
To
03/11/2008 11:38:17
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01359198
Message ID:
01359214
Views:
32
This message has been marked as the solution to the initial question of the thread.
>I have two tables (A and B) and in Table A there are to fields (IDRespG and IDRespP varchar(13) both) and in table B I have the IDUser (varchar(13)) and UserName
>
>TABLE A:
>IDRESPG    IDRESPP
>22222222    11111111
>11111111    73161768
>
>TABLE B:
>
>IDUSER   USERNAME
>11111111 Peter G
>22222222 Charles D
>73161768 Vicky B
>
>So, the output should be:
>
>Charles D  Peter G
>Peter G     Vicky B
>
Try
select TA.UserName as First_User, TB.UserName as Second_User 
from TableA Descr INNER JOIN UserName TA 
ON Descr.IDRESPG = TA.IDUSER ;
INNER JOIN UserName TB 
ON Descr.IDRESPP = TA.IDUSER ;
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform