如何仅从一行中扣除?

时间:2019-06-26 07:07:17

标签: sql-server

比方说,我有3行具有相同的客户ID // dynamic var a = 'test'; exports[a] = 1; exports.test = 1; // exports with module.exports exports.a = 1; module.exports = { a: 2 }; 。但是,我只想扣除不。仅来自第一行的约会Invoice_CustomerName的日期。我在下面的查询将为具有相同客户ID的每一行扣除1个约会。

Invoice_TotalAppointment

我怎么只扣除第一行?

1 个答案:

答案 0 :(得分:1)

设法解决了我的问题:)

UPDATE InvoiceNew SET Invoice_TotalAppointment = Invoice_TotalAppointment - 1
           WHERE Invoice_ID = (SELECT MIN(Invoice_ID) FROM InvoiceNew 
                      WHERE Invoice_CustomerName = @Appointment_ContactID 
                      AND (IsDelete = 0 OR IsDelete = NULL)
                      AND (Invoice_TotalAppointment != 0))