Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL update one table from another table
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


monali aundhakar
update one table from another table
0 Answer(s)      9 months ago
Posted in : SQL


hello, i need to update one table fields by using another table fields. I have to tables Products and ProductsPurchased,as i add any item to ProductsPurchased, all the fields related to that items in Products (like ProductName ,TotalQuantity,TotalPrice) should be updated. for example TotalQuantity field from Products table should be updated if i enter the Quantity field in table 'Products_Purchased'In table 'Products' one item should be shown only once. i tried this one but it gives null outpot for TotalQuantity.here is my code

update products as a,productspurchased as b set a.totalquantity=

case

when a.dateoflastupdate < b.PurchaseDate

then (select * from (select sum(products.totalquantity)+sum(productspurchased.quantity) from products natural join products_purchased)as c)

else a.total_quantity

end

where a.productname=b.productname ; share|edit


Advertisement
View Answers

Related Tutorials/Questions & Answers:
update one table from another table
update one table from another table  hello, i need to update one table fields by using another table fields. I have to tables Products.... for example TotalQuantity field from Products table should be updated if i
copying data from one table to another
copying data from one table to another  i need to copy data from one table to another table.. i.e the 1st eid of employee table must be copied to the 1st eid in appusers table, 2nd eid of employee to the 2nd eid of appusers
Advertisements
retrieve the records from one table to another table by using cursors
retrieve the records from one table to another table by using cursors  ... from one table to another table by using cursors.The following is my procedure and tables.After execution it insert one extra record to another table. empproc
take data from one table and insert same in another
take data from one table and insert same in another  I want to know when a new field update in table and the same data has to update in another table
mysql select into table from another table example
from one table into another table. Check the example at MySQLselect into new...mysql select into table from another table example  Can you suggest the correct example of select into table from another table example in MySQL
Copy One Database Table to Another
Copy One Database Table to Another   ... to another database table. That means we copy one table to a different table...;java CopyOneDatabaseTableToAnother Copy data from one database table
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
How to compare two tables, and insert values which r not in one table to another table?
How to compare two tables, and insert values which r not in one table to another table?  Hi I need to compare two tables MainTable and OUTTable... MT (MT.serialno) values (Select SerialNo Main_Table MT from where not exists
How to update table in Hibernate
How to update table in Hibernate  Hi, I have a table in database that has two fields in it. Student Name and ID, can anyone explain me how to update these tables in Hibernate. Thanks.   Update table query in Hibernate
Foreign key update table
Foreign key update table  How to update table that has the foreign key in SQL..?   ALTER TABLE YourTable ADD CONSTRAINT FK_YourForeignKey... (YourPrimaryKeyColumn) ON UPDATE CASCADE
Adding a flex table in another flex table column
Adding a flex table in another flex table column  how to add a flex table in another flex table column
How to update table column from the values of Arraylist in java
How to update table column from the values of Arraylist in java  Hii Sir, I have an arraylist containing these values [2, 1, 1, 1, 1, 1, 1... column of database table. plz give me the code of this problem.Thank you Sir
how to count unique and duplicate values from one table in mysql?
how to count unique and duplicate values from one table in mysql?  I have use EMP table.I want to count unique and duplicate records from emp table and how to use in java program
how to insert one table to anothere table
how to insert one table to anothere table  i have insert the record one table then i retrve the value of that table i insert one value at a time
can we update table in hibernate with out primary key in table?
can we update table in hibernate with out primary key in table?  can we update table in hibernate with out primary key in table
update a particular of mysql table using servlet
update a particular of mysql table using servlet  how to update a particular column for the entire table by taking requests from html form and update the particular column with out affecting other attribute values in the tuple
Display table performing action on another table
Display table performing action on another table In this section, we have created two tables. The data in table 1 have shown as a result of the database... of the table row, another table will be displayed showing the data of that row
how to update table using inner joins
how to update table using inner joins  how to update table using inner joins
redeploy project update database table
redeploy project update database table  **Dear Sir, i am using Hibernate 3.3 and spring 3.0 and mysql database. Now while redeploying project In tomcat 6 i want to run a sql query Thanks for your wise comments
Adding button to each row for the table and adding row to another table
Adding button to each row for the table and adding row to another table  Hi I need to add button to each line in the table(Table data is retrived... row of the table
how to insert the bulk data into the data base from the table of jsp page to another jsp page
how to insert the bulk data into the data base from the table of jsp page to another jsp page  pls help i'm doing the project called centralized... and i have to insert the mark for n number student in the table i don't how
how to get multiple hyperlink values from a table column to another jsp file?
how to get multiple hyperlink values from a table column to another jsp file... file named "dbtable" will get the parameter from "index" and search for the user string in the database, as a result a table will come up with 3 columns itemid
Pls provide me jsp code to get values in drop down list from another table's field....
Pls provide me jsp code to get values in drop down list from another table's field....  my project has customer registration and company registration pages..... when i insert data in company registration .. it ll have company id
table
table  multiplicatyion table
how to move records from one table to other based on its creation time
how to move records from one table to other based on its creation time  Hi all,, As part of my requirement ,the records in one table have to move... to the second table,has to delete from first table.. I am using oracle10, Any suggestions
table?
can't figure out, how to construct a table,with two fixed columns, one that reads...table?  Hi, how could i make a table in javascript, which would look... (from the user). Last two need mathematical inteference which I can do, but i
Mysqldump one table - Taking dump of only one table
Use of mysqldump for taking backup of one table In this section you will see the example of mysqldump function which takes the backup of only one table... table from the database
table
input from oracle table(my database table..) This is a very important table of my
print the multiplication table up to one
print the multiplication table up to one  My problem is that I have... be the highest one. An example: if the user tells the program that the highest...; System.out.println("Enter an integer to print it's multiplication table
TABLE
TABLE   Why doesn't <TABLE WIDTH="100%"> use the full browser width
retrieve record from table
for a single record. I have to retrieve these data from the field table. Actually...retrieve record from table  Hi. I have a field in database named... chennai as one value, trichy as one value. and i have to show it in html. how
 

 

 

DMCA.com