'How to have the result of a select query being inserted as a value of an attribute in an insert statement
As mentioned in the title, I am trying to have a the result of a select query inserted in an insert statement, the code is:
INSERT INTO entry (
event_id,
entry_no,
entry_starttime,
entry_finishtime,
comp_no,
team_id,
char_id
) VALUES (
**SELECT event_id FROM event WHERE carn_date = to_date((SELECT carn_date FROM carnival WHERE carn_name = 'RM Autumn Series Caulfield 2022'), 'DD/MM/YYYY') and eventtype_code = '21K',**
1,
TO_DATE('08:31:44', 'HH24:MI:SS'),
TO_DATE('09:02:44', 'HH24:MI:SS'),
6,
NULL,
NULL
);
I am trying to have the result of SELECT event_id FROM event WHERE carn_date = to_date((SELECT carn_date FROM carnival WHERE carn_name = 'RM Autumn Series Caulfield 2022'), 'DD/MM/YYYY') and eventtype_code = '21K' being inserted as the value of event_id but it is giving me syntax error saying that 'missing expression'.
But when I run the select statement individually it perfectly gives out the desired result. Which is 14.
Thank you in advance for your help.
Solution 1:[1]
I think the $headers shouldn't be an array, just use simple string. you can see the example #2 here https://www.php.net/manual/en/function.mail.php
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Atoli Gaming |
