Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
afri
Starting Member
8 Posts |
Posted - 2014-03-12 : 14:23:24
|
w have 2 table :item and transactionitem transactionid name period id area amount 1 clothes 2011-10 1 north 12002 bike 2011-11 1 west 13003 car 2011-11 2 east 300resultperiod id amount 2011-10 1 12002011-10 2 02011-10 3 02011-11 1 13002011-11 2 3002011-11 3 0i have tried to create query for get a data like a table result abovebut still not macthmy queryselect b.period,a.id,b.amount from transaction b left join item a on a.id =b.id order by dateplease help for this.thanks |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-03-12 : 16:41:01
|
Create a calendar table that has all the periods that you want to show in the output data. Then left join your two tables to that new table.What is the data type of the period column in your existing tables? |
|
|
|
|
|