I want to combine the two following queries, can anyone give me a idea how to do that?
(the INSERT
query should run only if the SELECT
query has a result)
query no 1:
INSERT IGNORE INTO senders(
sender_id,
telephone,
)
VALUES ( 1, 0723355888)
query no 2:
SELECT student_name
FROM students
WHERE student_id =1
try this:
or if telefone is not a part of the students table, hard code it: This works because if the query 0 rows, no insert is performed at all.
try using this query -