I have a problem with INSERT Query. I want to insert some fixed values as a name but as well some calculated values. A simple example:
INSERT INTO Players
VALUES('Name', 10.0, SELECT COUNT(*) AS Amount FROM Stack7 WHERE Name LIKE '%Name%', 1.0)
Table Players:
CREATE TABLE `Players` (
`Name` TEXT,
`Points` REAL,
`Games` REAL,
`Result` REAL
)
Compiler says: near "SELECT": syntax error:
Put your select in Brackets:
In this way the compiler knows where the one value defined by your select statement starts and where it ends. And you are able to use a comma (
,
) inside your brackets if needed.