这个情况处理数据看看大家有没有简单的处理办法
以前做的查询数据时用s='select * from t_x where 1=1';
根据用户选择的条件拼凑出sql语句,
然后查询出结果并显示给用户。
现在需求改变,需要把查询出来的数据,
另存到另外的数据表中,有什么快捷的办法呢?
[解决办法]
先建好表table1,查询条件一样,insert一下不就ok了
- Delphi(Pascal) code
…… begin …… s:='insert into table1(a,b,c,d) ' s:=s+'select a,b,c,d from t_x where 1=1'; if 某条件 then //用户选择的条件 s:=s+' and 条件'; …… …… s:='select a,b,c,d from table1';//查询显示数据 …… end ……