问题描述
我正在图书馆项目中工作.
我有两种形式,即frmBooks和frmIssueRegister
和表格书籍和问题
我在表格中的字段是:Totalcopies,IssuedCopies,LeftCopies
当我发行一本书(frmIssueRegister)并保存时,应该
在frmBooks中进行以下更改:
总份数= 10
已发行副本= 3
库中的左副本= 7
类似地,在归还我的书时,应减去:
总份数= 10
已发行副本= 2
库中的左副本= 8
请帮我!!!!!!
I m working in a library project.
I have two forms i.e frmBooks and frmIssueRegister
and tables books and Issue
My fields in table books are : Totalcopies, IssuedCopies,LeftCopies
when I m issuing a book (frmIssueRegister)and on saving it should
do the following changes in frmBooks:
Total copies= 10
Issued copies=3
Left Copies in library = 7
similarly on returning i book ,it should subtract:
Total copies= 10
Issued copies=2
Left Copies in library = 8
Please help me out !!!
推荐答案
SELECT TotalCopies,
IssuedCopies,
TotalCopies - IssuedCopies AS CopiesLeft
FROM ...
最好不要使用已存储的计算字段(至少以可以修改的方式).
It''s a good rule of thumb that calculated fields should never be store (at least in a way that they can be modified).
update frmIssueRegister set Issuedcopies=Issuedcopies+1,leftCopies=leftCopies-1 where bookid='123'
希望对您有帮助
hope it will helps you
这篇关于如何添加和删除但应保留记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!