Reputation: 962
Is this valid?
SELECT COUNT(*) INTO mydb.table.field FROM sometable WHERE points=30;
If it's not.. anybody who can tell me a similar solution?
Upvotes: 1
Views: 218
Reputation: 16512
No, yours would be exactly like this one
INSERT INTO mydb.table (field)
SELECT Count(*)
FROM sometable
WHERE points=30;
Another example with more columns
INSERT INTO mydb.table (Col1, Col2, Col3)
SELECT Col1, Col2, Count(*)
FROM sometable
WHERE points=30;
Here you can find many examples.
Upvotes: 2
Reputation: 2821
INSERT INTO myTable (field) VALUES
(SELECT COUNT(*) FROM sometable where points=30)
Upvotes: 1