再问.这个功能Mysql能实现吗????
klggg 2002-10-14 01:14:03 以下表的结构和内容,
CREATE TABLE PactRate (
id int(11) NOT NULL auto_increment,
PactId int(11) default NULL,
GatheringYear int(5) default NULL,
PactCost int(11) default NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id)
) TYPE=MyISAM;
INSERT INTO PactRate VALUES (1, 1, 1999, 19990);
INSERT INTO PactRate VALUES (2, 1, 2000, 12000);
INSERT INTO PactRate VALUES (3, 3, 1002, 12000);
INSERT INTO PactRate VALUES (4, 4, 2002, 50000);
INSERT INTO PactRate VALUES (5, 5, 2002, 100);
怎么样得到这样的结果
id PactId GatheringYear PactCost
2 1 2000 12000 *
3 3 1002 12000
4 4 2002 50000
5 5 2002 100
运行 mysql语句
select * from PactRate group by PactId
只能得到
id PactId GatheringYear PactCost
1 1 1999 12000 *
3 3 1002 12000
4 4 2002 50000
5 5 2002 100
在线等待..