Updating table in mysql

(as i understand this increments the id and add the data)CREATE TRIGGER worklog_update AFTER INSERT ON worklog FOR EACH ROW REPLACE INTO support_time_monthly_hours ( Project ID, month Total Time, Year, Month ) SELECT jiraissue.PROJECT, SUM(worklog.timeworked), YEAR(CURRENT_DATE()), MONTH(CURRENT_DATE()) FROM worklog, jiraissue WHERE worklog.issueid = jiraissue. PROJECT = (SELECT PROJECT FROM jiraissue WHERE NEW.issueid = jiraissue.Would you like to answer one of these unanswered questions instead?So far you have learnt how to put information into your My SQL database, view the information in it and select which information you would like to view.INSERT INTO table (id, name, age) VALUES(1, "A", 19) ON DUPLICATE KEY UPDATE name=VALUES(name) , age=VALUES(age)The other problem with REPLACE INTO is that you must specify values for ALL fields...otherwise fields will get lost or replaced with default values.

First of all, we connect to the database and select the appropriate record.

If there are duplicates, then to only pull the record which has the newest time stamp.

Thanks CREATE TABLE sample.taceledger ( `runno` INT(10) unsigned not null default '0', `doc_no` DECIMAL(6,0) unsigned NOT null , `doc_date` DATE, `gl` DECIMAL(4,0) unsigned not null , `slcode` VARCHAR(6) not null , `tr` VARCHAR(1) not null , `cr_db` VARCHAR(1) not null, `amount` DECIMAL(13,2)unsigned not null , `revcode` DECIMAL(4,0)unsigned not null , `narration` VARCHAR(30)unsigned not null, `cramt` DECIMAL(13,2) unsigned not null, `indi` VARCHAR(1)not null , `dbamt` DECIMAL(13,2) unsigned not null, `acctype` VARCHAR(1) unsigned not null, PRIMARY KEY (`runno`) )ENGINE=Inno DB; I am getting error #1064 on `indi` line I am unable to clear it can u find some solution I'm making a table with employees for a store.

This didn't initially work for me because my ID was not unique.

Also note that you can use VALUES (name) to reference to the value you attempt to insert e.g.

Search for updating table in mysql:

updating table in mysql-55updating table in mysql-66updating table in mysql-19

As well as using a loop to get information from a database as we have before, you can also use loops to execute queries.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating table in mysql”