SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Joining Back into table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

masond
Constraint Violating Yak Guru

447 Posts

Posted - 06/14/2013 :  08:33:27  Show Profile  Reply with Quote
Hey Guys

Sorry to bother you with such a dump question
Aim- i need to the get account_Id of the parentsfid
The account_id is based on the #Update.FDMSAccountNo,

Parentsfid is the same as the #Update.FDMSAccountNo,

i would like to produce a new column called “ Parentaccount_Id

This is my table
Select
#Address.FDMSAccountNo,
Parentsfid,
#Update.FDMSAccountNo,
#Update.account_id
from #Address
inner join #Update on #Address.FDMSAccountNo = #Update.FDMSAccountNo

bandi
Flowing Fount of Yak Knowledge

India
2169 Posts

Posted - 06/14/2013 :  09:36:23  Show Profile  Reply with Quote
what is the problem here?

--
Chandu
Go to Top of Page

masond
Constraint Violating Yak Guru

447 Posts

Posted - 06/14/2013 :  10:36:55  Show Profile  Reply with Quote
HI bandi

Okay every Fdmsaccountno has a unique account_id ,

Every Fdmsaccountno has a parentfid, every parentfid also has an account_id

i need to loop back into the table join Parentfid onto fdmsaccountno so i can get the parentfid account_id

Hope that makes sense
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 06/14/2013 :  10:52:23  Show Profile  Reply with Quote
sounds like this to me

if not post some data

Select 
#Address.FDMSAccountNo,
Parentsfid,
u.FDMSAccountNo,
u.account_id,
u1.account_id as parentid
from #Address 
inner join #Update u on #Address.FDMSAccountNo = u.FDMSAccountNo
inner join #Update u1 on u.parentfid = u1.fdmsaccountno


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

masond
Constraint Violating Yak Guru

447 Posts

Posted - 06/14/2013 :  11:06:26  Show Profile  Reply with Quote
Thats exactly what i need

thank you very much :)

You guys are a saviour :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 06/14/2013 :  14:53:21  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000