两个表,一对多,如何把“多”那个表的某列的字符串加起来?例如:
表a
id
1
2表b
id,aid,x
1,1,abc
2,1,def
3,2,gh结果
aid,y
1,abcdef
2,gh
表a
id
1
2表b
id,aid,x
1,1,abc
2,1,def
3,2,gh结果
aid,y
1,abcdef
2,gh
解决方案 »
- 请教!关于strpchar问题!!
- jpg图片叠加文字
- 为什么两次取得打印机的分辨率不一样?!
- 从数据库中读出来的这种HTML代码如何显示呀?
- 如何把文件列表显示在ListBox1中!
- 一个小时内提的第三个问题,前两个已结,这一个看到答案马上结。见者有份!
- 请问自制控件里哪个是运行时激活的事件??????
- 请问怎么禁止DBGrid的自动post
- 是delphi 的bug还是.....?有关delphi中线程类TThread的最基本的理论问题
- > 和 <是什么意思?
- 本来一直运行得很好的程序,忽然报TabOrder property does not exist!
- 求助,动态创建组件出错,帮我看下,谢谢!
table2.close;
table1.mastersource := datasource1; // 假设datasource1.dataset = table1
table1.masterfields := 'aid';
table2.open;
table1.open;table1.first;
while not table1.eof do
begin
table2.first;
str := '';
while not table2.eof do
begin
str := str + Table2.FieldByName('x').asstring;
table2.next;
end;
// str 为你所需要的结果,在此处进行处理,比如写入数据库等
table1.next;
end;table1.close;
table2.close;