The given SQL query retrieves records from the tables "Inverter_History", "Equipment_Info", and "Equipment_Type" based on certain conditions. Here's a breakdown of the query:

  1. The first two lines set the variables "@__startTime_1" and "@__endTime_2" with specific timestamp values.

  2. The SELECT statement retrieves the following columns from the tables:

    • RecordTime
    • ThisPower
    • ThisElectricityPrice
    • TypeName from Equipment_Type
    • EquipmentName from Equipment_Info
    • EquipmentId (aliased as Id) from Equipment_Info
  3. The query performs a LEFT JOIN between the tables "Inverter_History" and "Equipment_Info" using the EquipmentId column.

  4. Another LEFT JOIN is performed between the result of the previous join and the "Equipment_Type" table using the EquipmentTypeId column.

  5. The WHERE clause applies the following conditions:

    • i.Deleted is not true
    • e.EnterpriseId equals '1638003434462388224'
    • e.IsEnable is true
    • e.Deleted is false
    • e0.IsEnable is true
    • e0.Deleted is false
    • e0.TypeName equals '逆变器' (Inverter in Chinese)
    • i.RecordTime is between the specified start and end timestamps

Overall, the query retrieves records from the Inverter_History table along with additional information from the Equipment_Info and Equipment_Type tables, based on the specified conditions.

SQL Query to Retrieve Inverter Data Between Specific Dates

原文地址: https://www.cveoy.top/t/topic/pyJI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录