开发者

incorrect syntax near ',' ..

开发者 https://www.devze.com 2023-02-01 21:14 出处:网络
I am having an error executing this query. Delete from customerpayment wher开发者_JS百科e customerid = 8, Paymentid = 1 , currentpayment = \'132\', startdate = \'1/1/2011\', enddate = \'12/31/2011\',

I am having an error executing this query.

Delete from customerpayment wher开发者_JS百科e customerid = 8, Paymentid = 1 , currentpayment = '132', startdate = '1/1/2011', enddate = '12/31/2011', status = 'Paid';


Use and instead of , and your query should work.

More precisely:

delete from customerpayment where customerid = 8 and Paymentid = 1 and currentpayment = '132' and startdate = '1/1/2011' and enddate = '12/31/2011' and status = 'Paid';

A few suggestions: it seems you're using string data structure for representing dates. This is bad practise and you should use your database's internal date structure for things like this.

If currentpayment is always a number, don't use string.

If you have only few possible status values, rather use a different table with all possible status values and then join it based on id.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号