Aji Andri <[EMAIL PROTECTED]> wrote on 04/15/2005 09:01:40 AM: > Yes, I want to update all row in one query > --- Michael Stassen <[EMAIL PROTECTED]> > wrote: > > Aji Andri wrote: > > > > > my table properties > > > > > > `STY_REPORT_200501` ( > > > `std_nis` int(10) NOT NULL default '0', > > > `std_class` varchar(10) default NULL, > > > `std_item` int(2) default NULL, > > > `std_value` float default NULL, > > > `std_letter` char(2) default NULL, > > > `std_entusr` varchar(10) NOT NULL default '', > > > KEY `std_class` (`std_class`), > > > KEY `std_item` (`std_item`), > > > KEY `std_value` (`std_value`), > > > KEY `std_letter` (`std_letter`), > > > KEY `std_entusr` (`std_entusr`) > > > ) TYPE=MyISAM; > > > > > > > > > I'm doing this query > > > SELECT * > > > FROM `STY_REPORT_200501` > > > WHERE 1 LIMIT 0 , 30 > > > > > > when I how do I make multi row update based on my > > > fetch result ? > > > > We need more information. Do you want to update > > those rows, or use the > > data in those rows to update another table? > > > > Michael > > > Use an UPDATE statement (http://dev.mysql.com/doc/mysql/en/update.html)
To convert a SELECT into an UPDATE, you invert your query so that your <table reference(s)> appears in the UPDATE clause and the columns to be changed appear in your SET clause. This statement will randomly pick 30 rows and change their std_item and std_value values. UPDATE `STY_REPORT_200501` SET std_item = 654, std_value=3.14159 WHERE 1 LIMIT 0 , 30 NOTE: According to the syntax in the docs, the LIMIT and ORDER BY clauses are only valid in single-table UPDATE statements. Shawn Green Database Administrator Unimin Corporation - Spruce Pine