Avatar of Zolf
Zolf
Flag for United Arab Emirates

asked on 

MSSQL Query help

Hello there,

I have this 2 tables SupplierOrder and SupplierOrderDetails which are linked by SupplierOrder PK. Now  I have this col called isComplete in the SupplierOrder table which I want o update to true once all the values in the SupplierORderDetails table's isComplete are all true for that supplierOrder ID.see the attachment for the tables. I have tried myseolf with this query but I think it could be a better way or more efficient.

SELECT 1 
        FROM supplierOrder so
        inner JOIN supplierOrderdetails sod 
          ON so.id = sod.supplierOrderID
       WHERE so.id = 1
         AND sod.isComplete= 1

Open in new window

12-30-2013-8-19-54-AM.gif
Microsoft SQL ServerMicrosoft SQL Server 2008SQL

Avatar of undefined
Last Comment
Hiran Desai

8/22/2022 - Mon