sql server - Need help on SQL join -


i have 2 tables below:


select 1 id, 'a' place  #places union select 2 id, 'b' place  union select 3 id, 'c' place union select 4 id, 'd' place 

select 'x' name, 2 start, 3 endd  #travel union select 'y' name, 4 start, 1 endd union select 'z' name, 1 start, 3 endd  select * #places select * #travel 

------------------------------

now want name/start place/end place using joins?

select #travel.*, pstart.place start, pend.place end #travel inner join #places pstart on pstart.id = #travel.start inner join #places pend on pend.id = #travel.end 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -