daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT group_id, name, register_date
  2. FROM (
  3.     SELECT  @group_number := IF(@group_id = group_id, @group_number + 1, 1) AS group_number,
  4.     @group_id := group_id as group_id,
  5.     name, register_date
  6.     FROM
  7.     (SELECT @group_number := 1) a,
  8.     (SELECT name, @group_id := group_id as group_id, register_date FROM users ORDER BY register_date DESC) b
  9.   ) c
  10. WHERE group_number <= 2
  11. Order by group_id
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top