php - 1250 - Table 'sub' from one of the SELECTs cannot be used in global ORDER clause -
php - 1250 - Table 'sub' from one of the SELECTs cannot be used in global ORDER clause -
i'm trying create chat site learning purposes, in course of study of that, want lastly 30 messages appear in ascending order w.r.t. time. like, latest messages @ bottom, oldest 1 @ top. after huge amount of googling , yet having found no solution help, had inquire this.
this mysql statement.it returns info want in descending order. is, latest ones @ top. if alter asc desc, nil happens.
select * (select msg,sender chatlogs user1='userone' , user2='usertwo' order 'timeofmsg' desc limit 30) sub order 'sub.timeofmsg' asc
after lot of testing , trying solutions out, found out myself when seek sort resultant table using phpmyadmin's ui, throws next error. turns out it's mysql bug of sorts. how work way around it?
1250 - table 'sub' 1 of selects cannot used in global order clauseif can tell me how print query in reverse, help. no matter how help, please explain how solution work... i'm beginner @ this.
your first issue you're trying "order by" on column not nowadays in table "sub". you'll need homecoming in alias:
select * (select msg,sender, timeofmsg chatlogs user1='userone' , user2='usertwo' order timeofmsg desc limit 30) sub order sub.timeofmsg asc
php mysql sql
Comments
Post a Comment