Combine two queries in to one
Combine two queries in to one
Hi I am new to sql I just want to ask for advice my query is working fine it gives me my desired output but I wanted to make it in one query only I want to combine my delete query to the select query. I would really appreciate anyone can teach me how to do it
Delete from tblexample where RStatus = 'Done';
SELECT t3.RStatus,t1.Name,t2.gender,t1.Rnum,t1.NB,t1.fN
FROM table1 t1
INNER JOIN table2 t2
ON (t1.fN = t2.fln)
LEFT JOIN (
select * from tblexample t3
) AS t3 ON t1.NB = t3.NB where t3.RStatus is null
Like if possible I want to delete firs before I left join the tblexample
According to my understanding of SQL Concepts it is not possible to combine DML and select statements..
– codeLover
Aug 27 at 8:38
how can I wrap them in transaction?
– Wonderer
Aug 27 at 8:44
What do you mean by "combine"?
– Kamil G.
Aug 27 at 8:45
like if possible delete first then select?
– Wonderer
Aug 27 at 8:46
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You can't. But you can wrap them up in a transaction
– Strawberry
Aug 27 at 8:35