I have a table that contains:
id seller_id amount created_at 1 10 100 2017-06-01 00:00:00 2 15 250 2017-06-01 00:00:00 .
This worked:
DB::table('snapshot as s') ->select('s.*') ->leftJoin('snapshot as s1', function ($join) { $join->on('s.seller_id', '=', 's1.seller_id'); $join->on('s.created_at', '<', 's1.created_at'); }) ->whereNull('s1.seller_id') ->get();