What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 43953 |  Welcome, Guest!   Register  Login
 Home > Forums > Sql Server > Query for Update statement ...
Anurag_M84

Query for Update statement

Replies: 1 | Posted by: Anurag_M84 on 10/15/2012 | Category: Sql Server Forums | Views: 237 | Status: [Member] | Points: 10  


Hi All,


I have two tables whose structures are as follows: -


Table 1:-

Log In PayCon Name
123 XXXX ABC
321 ABC
456 .. DEF
654 DEF

Table 2:-

Code Data
123 321
456 654


I want to update the PayCon Column Data for LogIn "321" with the Data in "123" as the "Name" is same using the Table 2 "Code" column.


So I want to write an update query for the same.

If you can provide me solutions then I will be really helpful to you.

Anurag Manke


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Sourabh07
Sourabh07  
Posted on: 10/15/2012 4:14:52 AM
Level: Starter | Status: [Member] | Points: 25

Please run the following code......to update the table1 column PayCon with the table2 column Data on the condition of the table2 column Code is reverse of the table1 column LogIn.....

Hopefully it will solve your problem...and if not then please let me know...

Query :

Update Table1
set PayCon=A.Data
from Table2 A
where LogIn = Reverse((cast(A.Code as varchar)))


Sourabh07

Anurag_M84, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 8:38:59 AM