strsql:='select (sum(chuqin_num)/( select * from zaiji where class_name= '''+edit4.Text+'''))*100 as 出勤率 from ' +tablename2; strsql:=strsql+' where kemu_name='''+combobox2.text+''''; strsql:=strsql+'and time='+edit1.text+'';
这样写为什么不行
strsql:=strsql+'and time='+edit1.text+'';
改为: strsql:=strsql+' and time='+QuotedStr(edit1.text); 试试
strsql:='select (sum(chuqin_num)/( select top 1 zaiji_num from zaiji where class_name= '''+edit4.Text+'''))*100 as 出勤率 from ' +tablename2; 这样好像也不大好 zaiji 和tablename2是怎么联系起来的阿
table1 field1 table2 field1 select avg(field1)/ (select field1 from table2 where condition) from table1 这里是sql Server下利用Northwind做的试验,成功。 SELECT AVG(UnitPrice) / (SELECT CategoryID FROM Categories WHERE CategoryID = 2) AS Expr1 FROM Products
strsql:=strsql+' where kemu_name='''+combobox2.text+'''';
strsql:=strsql+'and time='+edit1.text+'';
这样写为什么不行
改为:
strsql:=strsql+' and time='+QuotedStr(edit1.text);
试试
class-name zaiji-num
计算机1 40
计算机2 50
表计算机1班
kemu-name chuqin-num
计算机网络 30
计算机原理 20
这样好像也不大好
zaiji 和tablename2是怎么联系起来的阿
field1
table2
field1
select avg(field1)/
(select field1
from table2
where condition)
from table1
这里是sql Server下利用Northwind做的试验,成功。
SELECT AVG(UnitPrice) /
(SELECT CategoryID
FROM Categories
WHERE CategoryID = 2) AS Expr1
FROM Products