1241 - Operand should contain 1 column(s)

Hello.
First of all I must say that I am a newbie when it comes to MySQL.
Here is my problem.
I need update the field myChange of the table tbl_x with the value returned from query select for single field myType and where field myArea.
I try this update query and subquery but I have error: 1242 - Subquery returns more than 1 row
Can you help me?
Thanks for your time and hints.
Chevy


mysql> select version();
+---------------------+
| version()           |
+---------------------+
| 5.0.45-community-nt |
+---------------------+
1 row in set

mysql> UPDATE `tbl_x` t
JOIN(
	SELECT
		(
			(
				(
					(
						SELECT
							myNumberCurrentYear, myType
						FROM
							`tbl_x`
						WHERE
							1
						AND myArea = 'DX'
					)-(
						SELECT
							myNumberPreviousYear, myType
						FROM
							`tbl_x`
						WHERE
							1
						AND myArea = 'DX'
					)
				)/(
					SELECT
						myNumberPreviousYear, myType
					FROM
						`tbl_x`
					WHERE
						1
					AND myArea = 'DX'
				)
			)* 100
		)q
)x
ON q.myType = x.myType
SET t.myChange = x.q
WHERE
	1
AND myArea = 'DX';
1241 - Operand should contain 1 column(s)


SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `tbl_x`
-- ----------------------------
DROP TABLE IF EXISTS `tbl_x`;
CREATE TABLE `tbl_x` (
  `myType` varchar(255) default NULL,
  `myNumberPreviousYear` int(10) default NULL,
  `myNumberPreviousMonthYear` int(10) default NULL,
  `myNumberCurrentYear` int(10) default NULL,
  `myChange` decimal(10,0) default NULL,
  `myArea` char(6) default NULL,
  `myId` int(10) NOT NULL auto_increment,
  PRIMARY KEY  (`myId`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED;

-- ----------------------------
-- Records of tbl_x
-- ----------------------------
INSERT INTO tbl_x VALUES ('A', '1', '2', '5', null, 'DX', '1');
INSERT INTO tbl_x VALUES ('B', '4', '7', '4', null, 'DX', '2');
INSERT INTO tbl_x VALUES ('C', '1', '8', '2', null, 'DX', '3');
INSERT INTO tbl_x VALUES ('D', '2', '6', '6', null, 'DX', '4');
INSERT INTO tbl_x VALUES ('E', '2', '31', '9', null, 'DX', '5');
INSERT INTO tbl_x VALUES ('F', '3', '2', '16', null, 'DX', '6');
INSERT INTO tbl_x VALUES ('G', '7', '2', '22', null, 'DX', '7');
INSERT INTO tbl_x VALUES ('H', '5', '14', '9', null, 'DX', '8');

Seems as you are making things much to complicated or am I missing something?


update tbl_x
   set myChange = 100.0*((myNumberCurrentYear - myNumberPreviousYear)/myNumberPreviousYear)
 where myArea = 'DX'

Thanks you very much for your help
I’m really happy for your quickly answer.

I need relax :wink:

Good bye