I have two tables in a SQL Server database: table1 and table2
table1:
DATE NAME CREDIT
1/1/2011 BALU 100
1/3/2011 BALU 200
table2:
DATE NAME DEBIT
1/2/2011 BALU 100
1/3/2011 BALU 50
I want to display the report in following format:
DATE NAME CREDIT DEBIT
1/1/2011 BALU 100 0
1/2/2011 BALU 0 100
1/3/2011 BALU 200 50
My problem is that both tables have a date column.
How can I write the SELECT statement with a WHERE clause given that both tables have the same column named date?
I am still not positive about what you want, several details are missing. But based on experience working in similar queries I think this is what you might need (or close enough).