I dont have the SQL query but I can suggest a workaround to get the information you are looking for in a excel.
Create a group of the VM's for which you want to report the VM Power State and run a TopN report at the group level , just make sure you set the Top N number to be above the number of VM's in the group. This will give you a report of VM Power state which can be exported into excel
Hope this helps