You are reading a single comment by @Velocio and its replies. Click here to read the full conversation.
  • I need a scratchpad... this will do:

    SELECT (line / 50000) + 1 AS sitemap_file
          ,line
          ,item_type_id
          ,item_id
      FROM (
               SELECT row_number() OVER() AS line
                     ,item_type_id
                     ,item_id
                 FROM flags
                WHERE site_id = 234
                  AND item_type_id != 5
                  AND parent_item_type_id NOT IN (3, 5)
                ORDER BY last_modified ASC
           ) AS f
     ORDER BY line ASC
     LIMIT 50
    
About

Avatar for Velocio @Velocio started