I want to get the value of the where statement in a query.
For example:
UPDATE tablename SET name = 'test' WHERE lastname = 'doo'
I want query to return me 'doo'. Is there any sql solution for it ?
I want to get the value of the where statement in a query.
For example:
UPDATE tablename SET name = 'test' WHERE lastname = 'doo'
I want query to return me 'doo'. Is there any sql solution for it ?
I'm not sure if you really need this, but you have to use SELECT instead of UPDATE if you want to select any values, in following:
SELECT lastname
FROM tablename
WHERE name = 'test'
In this case you will select lastname where name is 'test'
You can use SELECT query with UPDATE query for that :
UPDATE tablename SET name = 'test' WHERE lastname = 'doo';select lastname from tablename where lastname = 'doo';
Above query will return lastname.
I don't know about other DataBase but for MS SQL Server you can use directly like this(may be it's not good but will work) 
UPDATE tablename SET name = 'test' WHERE lastname = 'doo';select 'doo' as lastname;
it will result the same as first query.