select 2 tables of data when one table has some column values as empty

Hello.

Need some help displaying data in my app datagrid...here is my problem..

if i have e.g. table A with 4 cols and 2 rows and values...col3 and col4 always start of empty..

Table A
              COL1, COL2, COL3, COL4
row1     val1,  val2,     empty, empty
row2     val1,  val2,     empty, empty

now when i have this data displayed on my datgrid i enter values into row1, col3 and col4 and then it gets saved to another table...

Table B
              COL1, COL2, COL3, COL4
row1     val1,    val2,   val3,    val4

now i need a SP that can bring me back my data that has been saved and the data still to be saved and display in my grid as...

row1     val1,    val2,   val3,    val4
row2     val1,    val2,   empty, empty

then once i then enter data into row2 and save again i want my SP to then display

row1     val1,    val2,   val3,    val4
row2     val1,    val2,   val3,    val4



Thanks...
LVL 1
razza_bAsked:
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.

ste5anSenior DeveloperCommented:
What's your actual problem? What does "datagrid" refer to? Why don't you requery your data?
razza_bAuthor Commented:
My problem is i want a query to return the combined data of table A and table B to my datagrid....

 row1     val1,    val2,   val3,    val4
 row2     val1,    val2,   empty, empty
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
what's the unique identifier for ur first table and second table?

from my understanding, u probably can use a union clause to solve your problem.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ste5anSenior DeveloperCommented:
It's a simple JOIN. But without keys it's hard to tell how the correct JOIN should look like.

E.g.

SELECT A.col1, A.col2, B.col3, B.col4
FROM tableA A 
  LEFT JOIN tableB B ON B.col1=A.col1AND B.col2= A.col2;

Open in new window

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
1. in Table A:

              COL1, COL2, COL3, COL4
row1     val1,  val2,     empty, empty
row2     val1,  val2,     empty, empty

are these 2 rows exactly the same?

2. what about records in Table B?
Vitor MontalvãoMSSQL Senior EngineerCommented:
The rows with 'empty' values will stay in Table A forever?
Why not delete them after being inserted in Table B?

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
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

From novice to tech pro — start learning today.