MySQL bir satır güncellemek zaman başka değişiklikler

2 Cevap php

Ben ürünleri ile bir tablo var.

artID   artName	stock	order

1   cables *100	0
2   cables *1	75

What should I do to asociate these 2 rows and get the stock in sync. The provider sells the cables in bulks on 100 units, and the retail store sells then as unit. The idea is: when "cables *1" run nearly out of stock set the order row to 1 so the employees know they need to buy more cables. I have a relations table defining multiple types of relations between articles (if this server for something) Obviously this is a very simplified version of the db.

Ben php ile çalışıyorum. Ama herhangi bir dil agnostik fikir hizmet edecektir.

2 Cevap

Eğer bir tetikleyici kullanarak düşündünüz mü?

Görmek

MySQL Trigger

ve

Databasedesign-resource

Ben GÜNCELLEME ateş edilecektir masada bir tetikleyici oluşturmak gerektiğini düşünüyorum ve ilk satırı güncelledikten sonra değerini değişecek.

İşte docs MySQL tetikler kullanmak nasıl bulunuyor.