标签:
/*部分字段*/
--create a permission (CUSTOMER_SETTINGS_EDIT) and assigned to admin role
insert into role_permissions(role_ID,permissions) select id ,‘CUSTOMER_SETTINGS_EDIT‘ as permissions from role where name=‘ADMIN‘;
/*全部字段*/
INSERT INTO applicationsettings (name, prefixlower, prefixupper, productbarcodeenabled, productshelflifeenabled, productiondateenabled)
SELECT c.name, c.prefixlower, c.prefixupper, c.productbarcodeenabled, c.productshelflifeenabled, c.productiondateenabled
FROM customersettings c;
/*多个记录,多表查询*/
UPDATE role_permissions
INNER JOIN permission ON permission.id = role_permissions.permissions_ID
SET role_permissions.permissions = permission.name;
标签:
原文地址:http://www.cnblogs.com/ly-radiata/p/4905278.html