请教两表查询
t1(xh,xm,x1,x2,y1,y2,...)t2(xh,xm,y1,y2,z2,z2...)
关联字段xh,现在要实现两表查询,查询结果包括两表所有字段(去掉重复字段),查询结果xh,xm,x1,x2,y1,y2,z1,z3...,请问怎么写select命令?
说明:两个表字段比较多,重复字段也不少,但内容是一样的。不想在select中一个个字段罗列,求教有没有什么更好的方法?
CREATE CURSOR t1 (xm c(10), xh c(10), x1 c(4), x2 c(6)) CREATE CURSOR t2 (xm c(10), xh c(10), y1 c(2), y2 c(6)) AFIELDS(at1, "t1") AFIELDS(at2, "t2") lcStr = "" FOR ln1 = 1 TO ALEN(at1, 1) lcStr = lcStr + ",Aa." + at1[ln1, 1] ENDFOR lcStr= SUBSTR(lcStr, 2) FOR ln1 = 1 TO ALEN(at2, 1) IF NOT at2[ln1, 1] $ lcStr lcStr = lcStr + ",Ab." + at2[ln1, 1] ENDIF ENDFOR SELECT &lcStr FROM t1 aa, t2 ab