Yes, you can do this in one statement:
INSERT INTO tempTable (payValue)
SELECT $ammount
FROM tempTable
WHERE id = '$id' and (more - less) / 75 <= 1.5;
EDIT:
Well, this is probably another situation where an insert
should really be an update
:
UPDATE tempTable
set payValue = $ammount
WHERE id = '$id' and (more - less) / 75 <= 1.5;
Use insert
when you want to add new rows. Use update
when you want to change the values of existing rows.
If you do want another row, then it would be something like:
INSERT INTO tempTable (id, payValue)
SELECT id, $ammount
FROM tempTable
WHERE id = '$id' and (more - less) / 75 <= 1.5;