set Q1= 'SELECT ID, EnquiryID, EnquiryDate, CompanyName, ContactPerson FROM EnquiryHeader WHERE ';
set Q1 = concat(Q1,RefID);
上面的查询RefID中的是过程中的参数 和RefID值是'DelFlg = 0和EnquirySource = 3'
那么如何在MYSQL中执行Q1?
答案 0 :(得分:0)
试试这个:
set @Q1 = CONCAT('SELECT ID, EnquiryID, EnquiryDate, CompanyName, ContactPerson FROM Syscon.EnquiryHeader WHERE ',RefID);
PREPARE makeQ FROM @Q1;
EXECUTE makeQ;
DEALLOCATE PREPARE makeQ;