mariasql 如何从 table 获取值并插入另一个 table
mariasql how to get values from table and insert into another table
您好,首先抱歉解释不当,但我会尽力
所以我有 2 table
table 1 = sb_admins 和
有列 =
1. aid (AUTO_INCREMENT)
2. user
3. auth
4. passoword
5. gid
6. email
table 2 = sb_admins_servers_groups 和
有列 =
1. admin_id
2. group_id
3. srv_group_id
4. server_id
我需要使用 INSERT INTO
从 aid 中获取值到 admin_id
我尝试过但失败了
INSERT INTO sb_admins_servers_groups (admin_id, group_id, srv_group_id, server_id)
SELECT aid FROM sb_admins
INSERT
INTO sb_admins_servers_groups (
admin_id,
group_id,
srv_group_id,
server_id
)
VALUES (
(
SELECT aid
FROM sb_admins
WHERE authid = '{steamid}'
),
'1',
'1',
'-1'
)
您好,首先抱歉解释不当,但我会尽力
所以我有 2 table
table 1 = sb_admins 和 有列 =
1. aid (AUTO_INCREMENT)
2. user
3. auth
4. passoword
5. gid
6. email
table 2 = sb_admins_servers_groups 和 有列 =
1. admin_id
2. group_id
3. srv_group_id
4. server_id
我需要使用 INSERT INTO
从 aid 中获取值到 admin_id我尝试过但失败了
INSERT INTO sb_admins_servers_groups (admin_id, group_id, srv_group_id, server_id)
SELECT aid FROM sb_admins
INSERT
INTO sb_admins_servers_groups (
admin_id,
group_id,
srv_group_id,
server_id
)
VALUES (
(
SELECT aid
FROM sb_admins
WHERE authid = '{steamid}'
),
'1',
'1',
'-1'
)