执行查询时出错

时间:2017-08-09 09:41:58

标签: mysql jdbc

我收到以下代码的语法错误 " executeQuery无法解析或不是字段"

ResultSet rsstore=stmt.executeQuery("SELECT FROM_UNIXTIME((dateOfBirth/1000), "%W, %M %d, %Y") DOB from QA_DATA_MART.CUSTOMER where programId='"+ProgrameID+"' and customerId='300000002';");

2 个答案:

答案 0 :(得分:0)

也许,您的报价有问题,请在查询中使用单引号:

ResultSet rsstore=stmt.executeQuery("SELECT 
FROM_UNIXTIME((dateOfBirth/1000), '%W, %M %d, %Y') from 
QA_DATA_MART.CUSTOMER where programId='"+ProgrameID+"' and 
customerId='300000002';");

为什么需要DOB

答案 1 :(得分:0)

SELECT FROM_UNIXTIME((dateOfBirth/1000), "%W, %M %d, %Y") DOB from QA_DATA_MART.CUSTOMER where programId='"+ProgrameID+"' and customerId='300000002';

请检查表格列的参考和拼写:

  • ProgrameID
  • customerId
  • DATEOFBIRTH