HiI need something like this pseudo code; [code="sql"]UPDATE OrdersSET InvoiceNo = MAX(InvoiceNo)FROM Orders INNER JOIN SetupAccountTypes ON Orders.AccountTypeID = SetupAccountTypes.IDWHERE (SetupAccountTypes.AccountType = N'COD') AND (Orders.DeliveryDate >= CONVERT(DATETIME, '2016-01-01 00:00:00', 102)) AND (Orders.DeliveryDate <= CONVERT(DATETIME, '2016-01-31 00:00:00', 102))[/code]That is, a bunch of rows selected under the given WHERE criteria get assigned invoice numbers incrementally.How do I achieve this please in T-SQL or otherwise?ThanksRegards
↧