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

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -