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 2005 Forums
 Transact-SQL (2005)
 select data from table to display in another table

Author  Topic 

cwfontan
Yak Posting Veteran

87 Posts

Posted - 2009-10-15 : 11:58:56
table 1
ID START LOAD DELIVER
1 123 432 123
2 123 532 123
3 123 262 235
4 123 433 235

table2
locID Name
432 PLace1
532 Place2
123 Place3
433 place4
235 PLaCe5
262 Place6

RETURN in query__________________________
ID START LOAD DELIVER
1 Place3 PLace1 Place3
2 Place3 Place2 Place3
3 Place3 Place6 PLaCe5
4 Place3 place4 PLaCe5

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-15 : 12:09:56
select
t1.ID,
st.Name as Start,
lo.Name as Load,
de.Name as Deliver
from table1 t1
join table2 st on st.locID = t1.START
join table2 lo on lo.locID = t1.LOAD
join table2 de on de.locID = t1.DELIVER


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

cwfontan
Yak Posting Veteran

87 Posts

Posted - 2009-10-15 : 16:22:57
THANKS U
Go to Top of Page
   

- Advertisement -