简体   繁体   English

如何获得在另一个表中添加记录的计数

[英]how to get a count of adding records in another table

i'm developing a product management system. 我正在开发产品管理系统。 in my project there is two modules as products(which is using tbl_product table in DB & have a column named as count) & supply(which is using tbl_supply table in DB). 在我的项目中,有两个模块作为产品(在DB中使用tbl_product表,并且具有名为count的列)和供应(在DB中使用tbl_supply表)。

the thing which i wanted to know is how to increase the count of the products in the tbl-product when inserting products using supply module. 我想知道的是,使用供应模块插入产品时如何增加tbl产品中的产品数量。

i wrote the insert function but i couldn't write the update function to increase the count 我写了插入功能,但我不能写更新功能来增加计数

if someone can help to solve this i'll be very thankful 如果有人可以帮助解决这个问题,我将非常感激

When you add a supply in table. 当您在表中添加供应时。 Run a query to increase count = count + 1 Like that. 运行查询以增加count = count + 1这样。

UPDATE tbl_product SET count=count+1 WHERE product_id=product_id 更新tbl_product SET count = count + 1 WHERE product_id = product_id

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

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