Hello.
I Have Two Table From Which I want to Create Query
1) Table - Purchase
PurchaseID,ItemID,PurchaseDate,PurchaseQuantity
2) Table- Sale
SaleID,ItemID,SaleDate,SaleQuantity
Now I want to Create A query to Give this Result Between Two Dates From Both Tables
| ItemID | TotalPurchaseQuantity | TotalSaleQuantity |
The Problem is Date From Which Table I should Give Date To Query (Sale Table Or Purchase)


Pankajkumar PatelRank #181 · 13.4K reputationPosted Dec 26, 2019, 5:57 PM EST
Can you please try following:
Good to know that query worked.
Now, you want to get ItemName also from Item Table. To Join it with item table "CTE Query" can be used like following:
Amit MohantyRank #112 · 20K reputationPosted Dec 26, 2019, 1:06 AM EST
Suraj KumarRank #353 · 7.1K reputationPosted Dec 26, 2019, 1:16 AM EST
Suraj KumarRank #353 · 7.1K reputationPosted Dec 26, 2019, 1:34 AM EST
Rafnas T PRank #280 · 8.8K reputationPosted Dec 26, 2019, 3:00 PM EST
Rafnas T PRank #280 · 8.8K reputationPosted Dec 26, 2019, 3:03 PM EST
Arifullah IrfannRank #4,270 · 354 reputationPosted Dec 27, 2019, 12:56 AM EST
Jignesh KumarRank #91 · 22.9K reputationPosted Dec 27, 2019, 1:01 AM EST
Suraj KumarRank #353 · 7.1K reputationPosted Dec 27, 2019, 1:39 AM EST
Arifullah IrfannRank #4,270 · 354 reputationPosted Dec 27, 2019, 6:44 AM EST