【发布时间】:2016-07-04 15:09:01
【问题描述】:
我的查询:
$att="select
AttData.Rollno,AttData.Name,AttData.Year,AttData.sec,AttData.".$date."
from AttData where AttData.sec='".$sec."' and AttData.dept='".$dept."'
and AttData.year='".$year."' and AttData".$date."='AB' ";
我的数据库设计视图是
我的错误
警告:odbc_exec() [function.odbc-exec]:SQL 错误:[Microsoft][ODBC Microsoft Access 驱动程序] 查询中的语法错误(缺少运算符) 表达式 'AttData.sec='A' 和 AttData.dept='cse' 和 AttData.year='IV' and AttData'02-07-2016'='AB' ''., SQL state 37000 in SQLExecDirect 在 C:\wamp\www\sms1.7.16\repotdaygen_allyear.php 上线 325 选择无效37000
【问题讨论】:
-
你的问题可能是
and AttData".$date."='AB',它变成了and AttData'02-07-2016'='AB'。不知道你想做什么,但像这样这是完全错误的。处理“AB”值的列的名称是什么? (我无法从工作中打开图像...) -
你需要一个空间
-
列名是'02-07-2016',值是AB或P
标签: php mysql sql-server