Results 1 to 2 of 2

Thread: Update First row in the table

  1. #1
    Leong Guest

    Update First row in the table

    Hi

    I have master and detail table. In master table I have one record and detail table I have more than 1 record for each invoice. I want to update first row in my detail table for each invoice. Is there any way I can update only first row for particular invoice. For ex. In T-SQL we can use "Select top 1 from tablename". Is there similar command to update 1 row in table. Thanks in advance

    Regards
    Leong

  2. #2
    Dale Shaw Guest

    Update First row in the table (reply)

    Hi

    You would have to perform the update based on Primary Key value of the selected record.

    UPDATE InvoiceDetails
    SET Something=1
    WHERE InvoiceDetailID=
    (
    SELECT TOP 1 InvoiceDetailID
    FROM InvoiceDetails
    WHERE InvoiceID=1234
    )

    Dale


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •