Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UPDATE invoices SET
- id = CONCAT (client,'-',
- order,
- IFNULL(variant,''),
- IF(subinvoice IS NULL, '',CONCAT('-',subinvoice))
- );
- DELIMITER //
- DROP TRIGGER IF EXISTS invoice_generate_id//
- CREATE TRIGGER invoice_generate_id
- BEFORE INSERT ON invoices
- FOR EACH ROW
- BEGIN
- NEW.id = CONCAT (client,'-',
- order,
- IF (variant IS NOT NULL) THEN
- variant
- ELSE ''
- END IF;
- ,
- IF (subinvoice IS NOT NULL) THEN
- CONCAT('-',subinvoice))
- ELSE ''
- END IF;
- );
- END//
- DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement