SQL Query

Hi all i am struggling with a query i have

I have two Columns in my query sn_account_1 and sn_account_2
sn_account_1  has null values that i need populating with sn_account_2
And sn_account_2 has Null values that i need populating with sn_account_1 , how can i acheive this i have posted the query below

SELECT     TOP (100) PERCENT dbo.V_sname_1.sn_account_1, dbo.V_sname_2.sn_account_2
FROM         dbo.V_sname_1 FULL OUTER JOIN
                      dbo.V_sname_2 ON dbo.V_sname_1.sn_account_1 = dbo.V_sname_2.sn_account_2
ORDER BY dbo.V_sname_1.sn_account_1

Thanks

John
pepps11976Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee SavidgeCommented:
Try this.

Lee
SELECT     TOP (100) PERCENT isnull(dbo.V_sname_1.sn_account_1, dbo.V_sname_2.sn_account_2) as dbo.V_sname_1.sn_account_1,
           isnull(dbo.V_sname_2.sn_account_2, dbo.V_sname_1.sn_account_1) as dbo.V_sname_2.sn_account_2
FROM         dbo.V_sname_1 FULL OUTER JOIN
                      dbo.V_sname_2 ON dbo.V_sname_1.sn_account_1 = dbo.V_sname_2.sn_account_2
ORDER BY dbo.V_sname_1.sn_account_1

Open in new window

pepps11976Author Commented:
Hi tried the code but i am getting '.' not recognised cant seem to find the error
Pratima PharandeCommented:
SELECT     TOP (100) PERCENT isnull(dbo.V_sname_1.sn_account_1, dbo.V_sname_2.sn_account_2) as  sn_account_1,
           isnull(dbo.V_sname_2.sn_account_2, dbo.V_sname_1.sn_account_1) as sn_account_2
FROM         dbo.V_sname_1 FULL OUTER JOIN
                      dbo.V_sname_2 ON dbo.V_sname_1.sn_account_1 = dbo.V_sname_2.sn_account_2
ORDER BY dbo.V_sname_1.sn_account_1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee SavidgeCommented:
Just remove the  dbo.V_sname_1 and  dbo.V_sname_2 from the alias names.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.