SQL query to check package status

sql query to check package status:

SELECT v_Package.PackageID, Name, SiteCode, ServerNALPath, State, InstallStatus

from v_Package

join v_PackageStatusDistPointsSumm PSUMM on v_Package.PackageID=PSUMM.PackageID where PSUMM.State = 0

state 0 = Package installation complete

state 1 = Waiting to Install