Jump to content

update query


sandy1028

Recommended Posts

I have two tables in which "id" is constant.

 

Table 1 columns are: id, value_of

 

The value_of column has the values "2010/07/10/name1_abc"

 

Table2 columns are id, key,value_id

 

value_id values are represented as "2010-07-11 00:00:00"

 

Now I have to change the value in table1.

 

select value-of from table1 cv, table2 c where c.id=cv.id and key=28
and c.id=153

 

This will return the value 2010/07/15/lon-abc.

 

Using the query I have check, if the values of "value_of" column and value_id are equal. If it is not equal then, I should not update "value_of".

 

i.e

"value_of" in table1 is "2010/07/10/name1_abc" and value_id is "2010-07-11 00:00:00",

then value_of should be changed to "2010/07/11/name1_abc"

 

if YYYY, MM, DD are same in two tables then I should not update the value or else I have to replace it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.