Update Category Lot Count
Update Category Lot Count . . .
UPDATE Category
SET categoryLotCount = 0,
categorySubLotCount = 0
, categoryMarketCount = 0,
categorySubMarketCount = 0
, categoryProcureCount = 0,
categorySubProcureCount = 0
WHERE categoryID > 0
SELECT categoryID
FROM Category
SELECT Count(lotID) as lotCount
FROM Lot
WHERE categoryID = #catLotCount.categoryID#
AND lotCloseQueue = 1
AND lotType <> 0
SELECT Count(lotID) as lotCount
FROM Lot
WHERE categoryID = #catLotCount.categoryID#
AND lotCloseQueue = 1
AND lotType = 1
SELECT Count(lotID) as lotCount
FROM Lot
WHERE categoryID = #catLotCount.categoryID#
AND lotCloseQueue = 1
AND lotType = -1
SELECT Count(lotID) as lotCount
FROM Lot
WHERE categoryID = #catLotCount.categoryID#
AND lotCloseQueue = 1
AND lotType = 0
UPDATE Category
SET categoryLotCount = #countSelect.lotCount#
, categoryMarketCount = #marketCount#
, categoryProcureCount = #procureCount#
WHERE categoryID = #catLotCount.categoryID#
SELECT categoryLotCount
, categoryMarketCount
, categoryProcureCount
FROM Category
WHERE categoryID1 = #catLotCount.categoryID#
OR categoryID2 = #catLotCount.categoryID#
OR categoryID3 = #catLotCount.categoryID#
OR categoryID4 = #catLotCount.categoryID#
UPDATE Category
SET categorySubLotCount = #categorySubLotCount#
, categorySubMarketCount = #categorySubMarketCount#
, categorySubProcureCount = #categorySubProcureCount#
WHERE categoryID = #catLotCount.categoryID#
Category lot counts successfully updated.