It is possible to record a data that have a straight row in mysql based on date or sequence?
- by user1987816
I want to get the data that have a straight Sell more than 3 times, it is possible in mysql? If not, how to get it right? I'm need it on mysql or php.
my database:-
+----------+---------------------+--------+
| Username | Date | Action |
+----------+---------------------+--------+
| Adam | 2014-08-20 22:30:20 | Sell |
| Adam | 2014-08-20 22:30:20 | Sell |
| Adam | 2014-08-20 22:30:20 | Sell |
| Adam | 2014-08-20 22:30:20 | Buy |
| Adam | 2014-08-20 22:30:20 | Buy |
| Adam | 2014-08-20 22:30:20 | Sell |
| Adam | 2014-08-20 22:30:20 | Sell |
| Adam | 2014-08-20 22:30:20 | Sell |
| Adam | 2014-08-20 22:30:20 | Sell |
| Nick | 2014-08-20 22:30:20 | Sell |
| Nick | 2014-08-20 22:30:20 | Sell |
| Nick | 2014-08-20 22:30:20 | Sell |
| Nick | 2014-08-20 22:30:20 | Sell |
| Nick | 2014-08-20 22:30:20 | Buy |
+----------+---------------------+--------+
From the table above, I need to list out all data that have a straight sell more then 3 times.
RESULT
+----------+---------------------+--------+-------------+
| Username | Date | Action | Straight 3+ |
+----------+---------------------+--------+-------------+
| Adam | 2014-08-20 22:30:20 | Sell | 3 |
| Adam | 2014-08-20 22:30:20 | Sell | 4 |
| Nick | 2014-08-20 22:30:20 | Sell | 4 |
+----------+---------------------+--------+-------------+