我要从 table2 中查出id,根据id在 table1中查姓名,该如何实现?
即:
select name from table1 where id=" select tid from table2 where tdate='''+Formatdatetime('yyyy-mm-dd',mytime)+'''and type='''+ztype+''' "
正确的语句该如何表达?另外,我要把查找出来的name付值给字符串变量str,该如何付?总不能str:=name吧?
谢谢
即:
select name from table1 where id=" select tid from table2 where tdate='''+Formatdatetime('yyyy-mm-dd',mytime)+'''and type='''+ztype+''' "
正确的语句该如何表达?另外,我要把查找出来的name付值给字符串变量str,该如何付?总不能str:=name吧?
谢谢
============
这句顺便说明一下,tdate,type都要表明是哪个表的,即如果tdate是table2得,要写成a.tdate,
type也类似.但是type好像是关键字。如果是关键字要用中括号[]扩起来
呵呵,你自己不是能够写了吗