[Phpmyadmin-devel] Simulate UPDATE query

Chirayu Chiripal chirayu.chiripal at gmail.com
Mon Jun 16 17:50:42 CEST 2014


On Mon, Jun 16, 2014 at 9:15 PM, Hugues Peccatte <hugues.peccatte at gmail.com>
wrote:

> 2014-06-13 19:00 GMT+02:00 Ashutosh Dhundhara <ashutoshdhundhara at yahoo.com
> >:
>
>> Hi,
>> I was working on RFE #861
>> <https://sourceforge.net/p/phpmyadmin/feature-requests/861/> (Simulate
>> UPDATE query).
>> Lets say I have two tables:
>>
>> `table_1`
>> +----+----------+
>> | id | value    |
>> +----+----------+
>> | 10 | value_10 |
>> | 20 | value_20 |
>> +----+----------+
>>
>> `table_2`
>> +----+----------+
>> | id | value    |
>> +----+----------+
>> | 10 | value_10 |
>> | 20 | value_20 |
>> +----+----------+
>>
>> UPDATE Query: UPDATE table_1, table_2 SET table_1.value = 'NEW_VALUE',
>> table_2.value='NEW_VALUE' WHERE table_1.id > 10 AND table_2.id > 10;
>>
>> This will affect 2 rows.
>>
>> How to simulate this query using SELECT statement?
>>
>> I was trying:
>>
>> SELECT DISTINCT table_1.value, table_2.value FROM table_1, table_2 WHERE
>> table_1.value <> 'NEW_VALUE' AND table_2.value <> 'NEW_VAUE' AND
>> table_1.id > 10 AND table_2.id > 10;
>>
>> but this only returns 1 row.
>> Can this be done in a single query only?
>>
>> Regards,
>> Ashutosh Dhundhara
>>
>
> Hi,
>
> Isn't it possible to run the query with
> set AUTOCOMMIT=0;
> and a rollback at the end?
>

Hi,

I doubt that it will work for non innodb databases.


>
> Hugues.
>
>
-- 
Regards,
Chirayu Chiripal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20140616/1878ab96/attachment.html>


More information about the Developers mailing list