insert 用户权限表 (用户名,功能名)
select a.用户名,b.功能名 from 用户名 a,功能名 b
where a.用户名+',*,'+b.功能名 not in
(select 用户名+',*,'+功能名 from 用户权限表 )
select a.用户名,b.功能名 from 用户名 a,功能名 b
where a.用户名+',*,'+b.功能名 not in
(select 用户名+',*,'+功能名 from 用户权限表 )
SELECT A.用户名,A.功能名,0
FROM (SELECT 用户名、功能名 FROM 用户,功能) A LEFT JOIN 用户权限 B
ON A.用户名=B.用户名 AND A.功能名=B.功能名
WHERE B.功能名 IS NULL
select a.用户名,b.功能名 from 用户 a,功能 b
where not exists
(select * from 用户权限表 c where c.用户名=a.用户名 and c.功能名=b.功能名 )
select a.用户名,b.功能名 from 用户 a,功能 b
where not exists
(select 1 from 用户权限表 c where c.用户名=a.用户名 and c.功能名=b.功能名 )
insert into 用户权限表(用户名,功能名,是否有权限)
select a.用户名,b.功能名,1
from 用户 a,功能 b
insert into 用户权限表(用户名,功能名,是否有权限)
select a.用户名,b.功能名,1
from 用户 a,功能 b
insert into 用户权限表(用户名,功能名,是否有权限)
select a.用户名,b.功能名,1
from 用户 a,功能 b
select a.* from
(select a.用户名,b.功能名,1
from 用户 a,功能
) a left join 用户权限表 b on a.用户名=b.用户名 and a.功能名=b.功能名
wheere b.用户名 is null