Every derived table must have its own alias

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

Background: the error of every derived table must have its own alias occurs during the query of linked tables

Error code:

        SELECT t1.id FROM zhfw_service_reply t1
        JOIN(
        SELECT id FROM zhfw_service_theme t3  WHERE
        updated_time < #{time}
        AND section_code = 'service'
        ) on t3.id = t1.theme_id

Cause: the alias of the table was omitted. Query to generate new tables every derived table must have its own alias . That is, the result of the join needs a new name. Replace with the following:

        SELECT t1.id FROM zhfw_service_reply t1
        JOIN(
        SELECT id FROM zhfw_service_theme  WHERE
        updated_time < #{time}
        AND section_code = 'service'
        )t3 on t3.id = t1.theme_id

Note the location of T3

Similar Posts: