* Raghudev Ramaiah > I need this since I have around 3 sets of 20 fields ....each are > of the same data type . > if i am able to use arrays , i can say > > integer[20] m1; > integer[20] m2; > integer[20] m3; > > if not , i will have to declare 60 fields > integer m1 to integr m60. > > any solutions please?its quite urgent!
A table is a kind of an array... You can store one integer on each row: CREATE TABLE m ( id tinyint unsigned not null, value int, primary key(id) ); INSERT INTO m VALUES (1,2),(2,4),(3,6),(60,120); SELECT value FROM m WHERE id=1; # == m[1] SELECT value FROM m WHERE id=60; # == m[60] ...or, using three integers 20 times: DROP TABLE m; CREATE TABLE m ( id tinyint not null, m1 int, m2 int, m3 int, primary key(id) ); INSERT INTO m VALUES (1,2,4,6),(2,4,8,12),(20,8,16,24); SELECT m1 FROM m WHERE id=1; # == m1[1] SELECT m2 FROM m WHERE id=20; # == m2[20] -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]