• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to maintain a table field's value from second table'value

 
Rd Dari
Ranch Hand
Posts: 212
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am working on a project and I want to substract quantity from a table using that field in second table.
e.g. I am using material_quantity in one table is 33 and I enter 30 in second table then first table's quantity should be reduce and update with 3

How it is possible with (java coding).

Thanks in advanced...
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go with Triggers, this makes your difficult job easier.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nasty data modelling. Are you stuck with this? If not, I would review it. You are making your life harder than it needs to be.

If you can't, triggers, as Muhammad suggests, are the way to go. Java code is not the place to do it because you are making your data model rely on one specific database client.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic