I am trying to insert value into mysql 5.1 table using the following statement
INSERT INTO `bp_measurements`
(`id_patient`, `time`, `location`, `systolic`, `diastolic`)
VALUES (
'2',
'2015-12-26 13:19:35',
(SELECT `id` FROM `gps_locations` WHERE `lon` = 20.40930 AND `lat` = 48.94990`),
'110',
'70'
)
But I am getting syntax error MySQL server version for the right syntax to use near '`),'110','70')' at line 2 (sorry for not putting this into code but it is not working because of apostrophes used). What am I doing wrong? I have tried some other solution from stackoverflow but I cant get them working
Thanks in forward
EDIT: this is the correct version of my statement
INSERT INTO `bp_measurements`
(`id_patient`, `time`, `location`, `systolic`, `diastolic`)
VALUES (
'2',
'2015-12-26 13:19:35',
(SELECT `id` FROM `gps_locations` WHERE `lon` = 20.40930 AND `lat` = 48.94990),
'110',
'70'
)
both these and accepted answer works so feel free to use any of them