elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: [1]
1  Programación / Bases de Datos / Hacer Triggers en un Procedimie en: 17 Mayo 2015, 07:58 am
Como puedo hallar  el subtotal automaticamente y el total (trigger), sabiendo que tengo que hacer procedimientos para cada una de las tablas y al momento de ejecutarlo se hallen automaticamente el sub y total. Tengo:


CREATE TABLE FACTURA(
NUMEROFACTURA INT PRIMARY KEY,
FECHA DATE NOT NULL,
TOTAL MONEY  NULL,
FKCLIENTE INT NOT NULL,
FKFEMPLEADO INT NOT NULL)

CREATE TABLE DETALLE (
NUMERODETALLE INT NOT NULL,
FKFACTURA INT NOT NULL,
CANTIDAD INT NOT NULL,
SUBTOTAL MONEY NULL,
FKPRODUCTO INT NOT NULL
)
CREATE TABLE PRODUCTO(
CODIGO INT PRIMARY KEY,
NOMBRE VARCHAR(100) NOT NULL,
VALORUNIT MONEY  NULL,
EXISTENCIA INT NOT NULL)


Ingreso un producto (con P.A) y luego a hacer una factura y luego detalle y automaticamente se hallen subtotal y total.

¿me ayudan por favor?- Ignoren las claves foraneas que no tienen que ver con el problema.
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines