Hello ,
There is 4 tables in my DB :
assign_details
receipt_details
rs_leaves
rs_colors
I should get all available data from "assign_details" and "receipt_details" tables , but now my query shows only common available data . For example when "assign_details" has an element that there is not in "receipt_details" or vice versa , query doesn`t show related row data to me . I tried to use Left Join or Righ Join but when I use it for one of them only data related to parent table will be shown and same data in other table doesn`t load in query , this is related SQL :
Also this screenshot shows tables details :
How can I reach to my favorite result ?
There is 4 tables in my DB :
assign_details
receipt_details
rs_leaves
rs_colors
I should get all available data from "assign_details" and "receipt_details" tables , but now my query shows only common available data . For example when "assign_details" has an element that there is not in "receipt_details" or vice versa , query doesn`t show related row data to me . I tried to use Left Join or Righ Join but when I use it for one of them only data related to parent table will be shown and same data in other table doesn`t load in query , this is related SQL :
Code:
Select assign_details.leafCode,
rs_leaves.leafName,
rs_colors.colorsCode,
COALESCE(Sum(Distinct receipt_details.recAmount), 0),
COALESCE(Sum(Distinct assign_details.assAmount), 0),
COALESCE(Sum(Distinct receipt_details.recAmount), 0) - COALESCE(Sum(Distinct
assign_details.assAmount), 0) As 'FWarehouse'
From assign_details Inner Join
rs_leaves On assign_details.leafName = rs_leaves.leafID Inner Join
rs_colors On assign_details.leafColor = rs_colors.colorsID Inner Join
receipt_details On rs_leaves.leafID = receipt_details.leafName And
rs_colors.colorsID = receipt_details.leafColor
Group By assign_details.leafCode,
rs_leaves.leafName,
rs_colors.colorsCode
Order By rs_leaves.leafCode
Also this screenshot shows tables details :
How can I reach to my favorite result ?