L
lsfh
Unregistered / Unconfirmed
GUEST, unregistred user!
sql1 := 'select a.Field1,a.Field2,a.Field3,substring(a.Field4,0,11) f,'+<br> 'substring(a.Field4,11,20) ff' ;<br> sql2 := 'from 表名 a ' ;<br> sql3 := 'where a.field1 =001 and a.field2 =张三 and a.field3 =00000001 and substring(a.Field4,0,10) ='+'1000-00-00';<br> for i := 2 to n do<br> begin<br> s := chr(i+64)+'.field4' ;<br> sql1 := sql1 + ',substring('+s+',11,20)' ;<br> sql2 := sql2 + ',表名 '+chr(i+64) ;<br> sql3 := sql3 + ' and a.field1 ='+chr(i+64)+'.field1 and a.field2 ='+chr(i+64)+'.field2 and'+<br> ' a.field3 ='+chr(i+64)+'.field3'+ ' and substring(a.Field4,0,11) = substring('+chr(i+64)+'.Field4,0,11) and '+<br> chr(i+63)+'.Field4 > '+ chr(i+64)+'.Field4' ;<br> end ;<br><br> sql := sql1+sql2+sql3;