ms access - SQL Inner Join two Columns(being the minimum from the one column) -


i working on project here have 2 tables, 1 expiry dates named tracking , 1 inventory data named inventoryreport. need gather minimum expiry date tracking table quantity associated , update inventoryreport table. unique identifier in each table sku number. far have, know is incomplete , have tried min() on tracking.expirydate appreciate suggestions.

update inventoryreport inner join tracking on [inventoryreport].[sku] = [tracking].[sku] set [inventoryreport].[expiry date]  = [tracking].[expiry date],  [inventoryreport].[quantity] = [tracking].[quantity]; 

if there exists nothing smaller something, minimum, or in sql:

update inventoryreport inner join tracking t on t.[sku] = i.[sku] , not exists(     select t2.[expiry date]     tracking t2     t2.[sku] = t.[sku] , t2.[expiry date] < t.[expiry date] ) set i.[expiry date] = t.[expiry date],        i.[quantity] = t.[quantity] ; 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -