this is sql query :
select s.part_name as Part_Name,s.part_no as Part_No,s.uom as UOM,
sum(distinct er.quantity) as Excess,sum(i.Invoice_Quantity) as import,
s.available_quantity as Balance from dr_Stock s
left join dr_ExcessReceipt er on s.part_no=er.part_no
left join dbo.dr_InwardEntry i on s.part_no=i.part_no
where month(er.Date)='7' and month(i._date)='7'
group by s.part_No,s.part_Name,s.uom,s.available_quantity
This query is runnig without error but it is not giving me a desired output
i have three table
dr_Stock
,
dr_ExcessReceipt
and
dr_InwardEntry
.
column part_no in dr_stock is primary key and part_no in dr_ExcessReceipt and
part_no in dr_InwardEntry is foreign key of part_no in dr_stock ,
if there are data in both foregn key column's table then it is giving proper data
but if there is no data in any of table dr_ExcessReceipt or in dr_InwardEntry then
it not retrieve any data, just retrieve column name
i want that if there are no data in any of the foreign key column's table then it should retrieve data where data is available in any of the table
thank You !!