mysql - Mysqli num rows shows 0 result -
i'm having 2 queries fetch return max voted , max voted down, first query returns 0 result , second return results indeed have quad checked results in database first return 0. have spent time debugging didn't come result. maybe 1 eye can't find wanted share eyes can find maybe or ? :) .
my first code of top votes query --------> returns 0
select m.id ,cm.id ,cm.userid,cm.replyto,m.username ,cm.message,cm.edited,cm.date,cm.voteup,cm.votedown chat_messages cm inner join members m on m.id =cm.userid cm.voteup - cm.votedown = (select max(voteup - votedown ) chat_messages deleted != 1 , voteup - votedown >= 5 ) , cm.room_id = 1 order cm.votedown asc,cm.voteup desc,cm.id limit 1
--------> gives me 0
and second top down votes query--------> works; i'm getting result
select m.id ,cm.id ,cm.userid,cm.replyto,m.username ,cm.message,cm.edited,cm.date,cm.voteup,cm.votedown chat_messages cm inner join members m on m.id =cm.userid cm.votedown - cm.voteup = (select max(votedown - voteup) chat_messages deleted != 1 , votedown - voteup >= 5) , cm.room_id = 1 order cm.voteup asc, cm.votedown desc, cm.id limit 1
any 1 have idea ?
edit:
i'm getting result if voteup - votedown >= 7
, here i'm getting foul , because in query have >=5 wonder why ?
edit2:
my database schema
id int(11) auto_increment userid int(11) replyto int(11) message text utf8_general_ci room_id int(11) edited text utf8_general_ci deleted int(1) date datetime date_edited datetime voteup int(11) votedown int(11)
Comments
Post a Comment