I am using SQL Report Builder 2016. I have 2 tables, named assets and DepreciationInfo, following is the structure of these tables. Table Assets:
ID|Name|Cost|Prior Dep|Prior Dep Period|Use Prior|
values would be like
123|Name|10000|4000|06/03/2014|True|
Table DepreciationInfo:
ID|EndDate|CurrentDepreciation|AccumulatedDepreciation|CarryingValue|Monthly|
values would be like
123|2020-04-30 00:00:00.000|2000|5000|5000|0/1|
I want to achieve following;
I want to select id from table assets, and will show all fields mentioned above from table assets along with fileds from table dep info based on "ID" , Column "ID" is same in both tables.
I am successful in getting all values when Id is common in both table using below mentioned query.
SELECT
Assets.ID
,Assets.Name
,Assets.Cost
,Assets.Prior Dep
,Assets.Prior Dep Period
,Assets.Use Prior
,DepreciationInfo.EndDate
,DepreciationInfo.CurrentDepreciation
,DepreciationInfo.AccumulatedDepreciation
,DepreciationInfo.CarryingValue
,DepreciationInfo.DepID
,DepreciationInfo.Monthly
FROM
Assets
INNER JOIN DepreciationInfo
ON Assets.AssetID = DepreciationInfo.AssetID
where DepreciationInfo.EndDate=@EndDate and DepreciationInfo.Monthly=0
What i want is that i want to show all results from table asset whether or not such id existed in table DepreciationInfo.
I tried all outer joins and result is same, it is showing number of records with Inner and Outer join.
Any help would be appreciated.