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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 select help

Author  Topic 

kumar7704
Starting Member

4 Posts

Posted - 2005-03-31 : 08:36:56
Hi,
Can someone help me with this..

I have a REQUEST table with the following fields
REQUEST(REQ_ID,REQ_START_DATE,REQ_INITIATOR_ID,REQ_IMPLEMENTOR_ID,REQ_VERIFIER_ID,......)
USER_INFO(USER_ID,USER_NAME,........)

initiator, implementor, verifier id are nothing but user id's....

I am trying to write a select statement to get the following info

REQ_ID,REQ_START_DATE,REQ_INITIATOR_ID,INITIATOR_NAME, REQ_IMPLEMENTOR_ID, IMPLMENTOR_NAME, REQ_VERIFIER_ID,VERIFIER_NAME

how can I do that....Is there something wrong in my table designs

thanks,

sahu74
Posting Yak Master

100 Posts

Posted - 2005-03-31 : 10:00:18
Can you give the complete table design with primary key and foreign key info?

PKS.
Go to Top of Page

kumar7704
Starting Member

4 Posts

Posted - 2005-03-31 : 10:22:16
The fields I mentioned are the important, i mean other can removed..
so it is
REQUEST(REQ_ID,REQ_START_DATE,REQ_INITIATOR_ID,REQ_IMPLEMENTOR_ID,REQ_VERIFIER_ID)
USER_INFO(USER_ID,USER_NAME)
with REQ_ID as primay key in REQUEST
and USER_ID as pk in USER_INFO...


Go to Top of Page

sahu74
Posting Yak Master

100 Posts

Posted - 2005-03-31 : 10:47:46
Try this..

PKS


SELECT T1.REQ_ID, T1.REQ_START_DATE, T1.REQ_INITIATOR_ID, T2.INITIATOR_NAME,
T1.REQ_IMPLEMENTOR_ID, T3.IMPLMENTOR_NAME, T1.REQ_VERIFIER_ID, T4.VERIFIER_NAME
FROM REQUEST T1, USER_INFO T2, USER_INFO T3, USER_INFO T4
WHERE REQ_INITIATOR_ID = T2.USER_ID
AND REQ_IMPLEMENTOR_ID = T3.USER_ID
AND REQ_VERIFIER_ID = T4.USER_ID

Go to Top of Page

kumar7704
Starting Member

4 Posts

Posted - 2005-03-31 : 11:06:43
It worked.
I really appreciate your help.

Thanks.
Go to Top of Page
   

- Advertisement -