update one table from another table
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
View Answers
Ads
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
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
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
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
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
table
table multiplicatyion
table
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
Copy Table in a MySQL Database
CopyOneTableToAnother
Copy data
from one table to
another in a database!
2...;
In this section, you will learn to
copy
one table to
another...
one
table to
another in a same MySQL database.
To copy any
table, firstly
table
input
from oracle
table(my database
table..)
This is a very important
table of my
Mysql From Table
Mysql
From Table
Mysql
From Table is used to specify the
table from which the records... for
From
The keyword '
from' is used to specify the
table 'Stu'
from which
records
Table
Table How i generate
table in showMessageDialog. I want that i creat a
table and run in showMessageDialogeprint("cprint("code sample");ode sample
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