一个select查询的问题,大家帮忙看下
EXEC SQL SELECT SUM(money) into totalmoney from TH_SERIALNOTABLEWHERE JOBNO=ct_serial.jobno AND TRBRNO=ct_serial.trbrno and DCFLAG=ct_serial.dcflag and TOTALFLAG=ct_serial.totalflag and TRADESTATUS=ct_serial.tradestatus;
ct_serial是结构体.
现在的问题是,后面的条件JOBNO=ct_serial.jobno ,TRBRNO=ct_serial.trbrno 等等,可能ct_serial.jobno的值是空的,我现在想让where后面的条件是一个变量,如果ct_serial.trbrno等的值为空,就不要加在条件里,可是我刚学数据库,不知道该怎实现,大家帮看下吧 谢谢 谢谢