Fix CTE query alignment