#include #include #include "mysql.h" int main(void) { static unsigned char aquery[]="SELECT name1,GROUP_CONCAT(id1) as col1 FROM t1 GROUP BY name1"; static unsigned char bquery[]="SELECT name1,GROUP_CONCAT(id1) as col1 FROM t1 GROUP BY name1 ORDER BY id1"; MYSQL *m; MYSQL_RES *r; MYSQL_ROW w; MYSQL_FIELD *fields; int numfields=0;int numrows=0; int i=0; m=mysql_init(NULL); mysql_options(m, MYSQL_READ_DEFAULT_GROUP, "bug14169"); if(!mysql_real_connect(m,"127.0.0.1", "root", "", "testdb",3306, 0, 0)) { printf("Cannot connect."); exit(1); } printf("Client info: %s\n", mysql_get_client_info()); printf("Server info: %s\n", mysql_get_server_info(m)); //query A - without ORDER BY mysql_query(m,aquery); r= mysql_store_result(m); numrows = mysql_num_rows(r); numfields = mysql_num_fields(r); fields = mysql_fetch_fields(r); printf("\n query A (without ORDER BY)\n"); numrows=0; while((w = mysql_fetch_row(r))) { printf("Row %d\n",numrows); for(i=0;i