是否可以添加插入查询到一行?当我将查询作为两个运行时,它们都会添加到不同的行中。
$query1 = "INSERT INTO `mysaved` (`Username`) VALUES ('bob123')";
$query2 = "INSERT INTO `mysaved` (`Name`, `Image`)
SELECT *
FROM sport b
JOIN sport a
on a.Tag = b.Name
where a.SportID <> b.sportID and a.Name = 'Football'"
答案 0 :(得分:2)
您可以将值放入select
。
INSERT INTO mysaved (Name, Image, Username)
SELECT name, image, 'bob123'
FROM sport b
JOIN sport a
on a.Tag = b.Name
where a.SportID <> b.sportID
and a.Name = 'Football'