Click here to Skip to main content
16,018,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CSS
Id  CategoryId  Category    Type    Description Mapped
61068   463 Cat1    Maximum Benefit Benefit : 100rs   1,2,3
61068   464 Cat2    Deductible      Deductible : 50rs   4,5
61068   464 Cat2    Maximum Benefit Benefit : 100rs  1,2,3
61068   465 Cat3    Maximum Benefit Benefit : 100rs  6,7
61068   464 Cat2    Maximum Benefit Benefit : 100rs 1,2,3


I have the above table and i have to update the same table with new modification
i need to write the query to get the below reult.

CSS
Id  CategoryId  Category    Type    Description Mapped
61068   463 Cat1    Maximum Benefit Benefit : 100rs 1,2,3
61068   464 Cat2    Deductible  Deductible : 50rs   4,5
61068   464 Cat2    Same as Cat1    Benefit : 100rs 1,2,3
61068   465 Cat3    Maximum Benefit Benefit : 100rs 6,7
61068   464 Cat2    Same as Cat1    Benefit : 100rs 1,2,3



need your help to update the same table to get the record updated.
Posted
Comments
StianSandberg 25-Apr-13 6:04am    
the two tables are identical?
sawant parag 25-Apr-13 6:14am    
first table the original table , i have . i want to read each row of the first table and update the table and make that table as the second table
StianSandberg 25-Apr-13 6:16am    
why would you do that if the data is the same?
sawant parag 25-Apr-13 6:19am    
ok ! i will create new table of the same column and insert into them, please let me know the solution whatever you feel fesible.

This is the absolute basics of sql. Please check out the link below and have a try. This isn't really a question because it seems you haven't tried anything yet.

http://www.w3schools.com/sql/sql_update.asp[^]

Good luck!
 
Share this answer
 
Comments
sawant parag 25-Apr-13 6:29am    
both are same table Nijboer , first table is the Existing table, i have to make it as in the second table.
Simple to explain:
i have one table with some records , it that records i have some cell value same , i have updat that cell with the other value.
E.F. Nijboer 25-Apr-13 7:11am    
Then select into that new table.
http://www.w3schools.com/sql/sql_select_into.asp
E.F. Nijboer you didint understand the question sir :) . yhnaks for your support and help.

As their is no primary key in this table it was difficult to solve by simple update statment.
I took the Distict from the first table and used while loop to irrearte the temp table of distinct .

In while loop i took the each and every ID and solved it to update it

thanks friends :) for your valuable inputs :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900