1
As I could make a self-deletable query in SQL, I would like to query such value and then delete in just one query. EX:
select * from usuarios where nome=lucas
that is to receive the search and delete result.
I know I could erase it later using:
DELETE FROM usuarios WHERE nome = lucas
But that’s not what I want, I wanted to know if in just one query it is possible to return the value and then delete.
For what purpose do you want to get everything in one query?? Doesn’t make much sense this.
– user28595
Diego, I think he wants to show everyone who’s been excluded. So I think if that’s it, he wants to do something very practical in a single query. It can be interesting if there is a native function that allows such execution. Although it doesn’t make much sense.
– Daniel Omine
@Danielomine if this is it, only comes to mind.
– user28595
I miss this feature a lot. Unfortunately you will have to do two same operations. At least I do not know how to delete getting return. And it seems that the people did not understand the question.
– Bacco
Bacco5, You understood perfectly my question kkk Thank you, And Thank you also to all those who as much as they did not understand very well, Had the patience to come here to give an attention, Thanks guys, Well I had to choose to do in the traditional way that is 2 queries.
– System_00110011
would be what you want?
DELETE FROM usuarios WHERE nome like '%lucas%'
;– Ivan Ferrer
If you delete a record there is no way to bring it in this same query. I don’t quite understand its logic. But ideally you do the query first, did you find the data? OK, you can delete it now.
– Ivan Ferrer