Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Top 2 Query
DROP TABLE IF EXISTS my_table; CREATE TABLE my_table (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,my_type CHAR(1) NOT NULL ,created DATE NOT NULL ); INSERT INTO my_table VALUES ( 1,'A','2017-04-09'), ( 2,'C','2017-04-09'), ( 3,'D','2017-04-09'), ( 4,'A','2017-04-12'), ( 5,'A','2017-07-09'), ( 6,'A','2017-11-08'), ( 7,'C','2017-05-09'), ( 8,'C','2017-09-12'), ( 9,'C','2017-10-01'), (10,'B','2017-04-09'), (11,'D','2017-05-17'); SELECT x.* FROM my_table x JOIN my_table y ON y.my_type = x.my_type AND y.id <= x.id AND y.created >= '2017-04-10' WHERE x.created >= '2017-04-10' GROUP BY x.id HAVING COUNT(*) <= 2;
run
|
edit
|
history
|
help
0
Srinivas
123
vwall
ACTIVIDAD
ITM_14210069
par
Create Procedure For Getting Grades Through Student Id and Marks
Get second least column in a row in mysql
My mysql code - sunil
cap 3