USE test;


CREATE TABLE table257 (
  N_O_data_id int(10) unsigned NOT NULL default '0',
  E_OA_recency int(11) default NULL,
  T_buy_1y int(11) default NULL,
  T_buy_6m int(11) default NULL,
  T_buy_2m int(11) default NULL,
  PRIMARY KEY  (N_O_data_id)
) ENGINE=MyISAM DEFAULT CHARSET=cp932;

LOAD DATA INFILE '/win/table257.csv' INTO TABLE table257 FIELDS TERMINATED BY ',' ENCLOSED BY '"';

SELECT T_buy_1y, COUNT(*) FROM table257 GROUP BY T_buy_1y;
SELECT T_buy_6m, COUNT(*) FROM table257 GROUP BY T_buy_6m;
SELECT T_buy_2m, COUNT(*) FROM table257 GROUP BY T_buy_2m;

SELECT * FROM table257 PROCEDURE ANALYSE();

ALTER TABLE table257 ORDER BY T_buy_2m DESC;
SELECT * FROM table257 PROCEDURE ANALYSE();

ALTER TABLE table257 ORDER BY T_buy_2m ASC;
SELECT * FROM table257 PROCEDURE ANALYSE();

