简体   繁体   English

SQL 命令根据年初至今或两个日期之间的已售库存更新再订购水平和数量

[英]SQL command to update re order levels and quantities based on stock sold year to date or between two dates

I tried to put the following into my Database Utility in IQ Retail, but it did not work.我尝试将以下内容放入 IQ Retail 的数据库实用程序中,但没有成功。

update Stock
set MIN_LVL=UnitsYearToDate/5
set ORD_QUANT=UnitsYearToDate/5*3
where (only using one of the following)
REGULAR_SU='xxx'
or
SUBDEPARTM='xxx'
or
CODE between 'xxx' and 'xxx'

I get this error我收到这个错误

"DBISAM Engine Error # 11949 SQL parsing error - Expected end of statement but instead found set in UPDATE SQL statement at line 3, column 1" “DBISAM 引擎错误 #11949 SQL 解析错误 - 预期语句结束,但在第 3 行第 1 列的 UPDATE SQL 语句中发现设置”

I have no programming knowledge, I am just trying to self help because of my remote location.我没有编程知识,由于我的位置偏远,我只是想自助。 Any advice on how I can update minimum order levels and order quantities in specific batches for about 12000 stock items would be appreciated.任何关于我如何更新大约 12000 个库存项目的特定批次的最低订单水平和订单数量的建议都将不胜感激。

I am using the packaged database utility in IQ Retail software.我正在使用 IQ 零售软件中的打包数据库实用程序。

Try below - you don't need to define set multiple times, just use one set and define multiple columns using comma (,)试试下面 - 您不需要多次定义集合,只需使用一个集合并使用逗号 (,) 定义多个列

update Stock set MIN_LVL=UnitsYearToDate/5,ORD_QUANT=UnitsYearToDate/5*3 
where REGULAR_SU='xxx' or SUBDEPARTM='xxx' or CODE between 'xxx' and 'xxx'

Your syntax is worng.你的语法很破旧。 Multiple SET must be separated by comma:多个SET必须用逗号分隔:

update Stock
set MIN_LVL=UnitsYearToDate/5, ORD_QUANT=UnitsYearToDate/5*3
where 
REGULAR_SU='xxx'
or
SUBDEPARTM='xxx'
or
CODE between 'xxx' and 'xxx'

As others have stated, the syntax is incorrect and when you have multiple SET you will need to separate them with a comma.正如其他人所说,语法不正确,当您有多个 SET 时,您需要用逗号分隔它们。 DBISAM order of execution can be different you will need to note that as well. DBISAM 的执行顺序可能不同,您也需要注意这一点。 Refer to this documentation for an UPDATE Statement有关UPDATE 语句,请参阅此文档

Try this code试试这个代码

UPDATE Stock SET MIN_LVL = 2, ORD_QUAN = 3 FROM Stock WHERE SUBDEPARTM = '0002';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM