« first day (1038 days earlier)      last day (3064 days later) » 

4:48 AM
ok
now i need help with another issue, lets say have 10 rows and showing on page in ASC or DESC order, is there a way to show those 10 rows in random order everytime page refresh, e.g first time> 1.2.3.....9.10, next time page reload, 3.4.5...1.2.3...9.10
yeah it is something like select * from myTable order by rand() limit N
. . . . yep confirmed it ... select * from tbl_emp order by rand() limit 3;
 
i read about rand() and php function array_rand() but what if there is another condition, lets say first 3 rows 1.2.3 always comes first and 4 up 10 in random order on every page refresh
 
yep that can be done too
and I literally just deleted an example of it to someone let me find it. I had 18 tabs open in my sql thingie wanted to houseclean
 
lol ok
you don't have house cleaning lady yet?
 
she is not allowed near the cpu
 
ahan, i also never allowed mine one to come near my workstation and wondering when the time will come that she will throw both my system and me out :P
 
5:00 AM
yeah it was a question like this one I remember my comment on it stackoverflow.com/a/33946084
everyone's data is different, so it doesn't need to go the route of find_in_set. It could go the way of a derived table nested, just about anything. The weirder the better I say
 
tich facepalm, this is the query I m already using SELECT * FROM tbl_company WHERE air_id='$objBooking->AirPortId' AND FIND_IN_SET($siteid,site_id) ORDER BY sequence
 
5:24 AM
it is getting a bit nested I like it
 
but i think I also have to use subquery, cause I think can't do like this ORDER BY FIND_IN_SET(colname, '1,2,3,4') with rand()
15
Q: MySQL ORDER BY rand(), name ASC

Josh KI would like to take a database of say, 1000 users and select 20 random ones (ORDER BY rand(),LIMIT 20) then order the resulting set by the names. I came up with the following query which is not working like I hoped. SELECT * FROM users WHERE 1 ORDER BY rand(), name ASC LIMIT 20

 
So to re-state, you want the first three always in that order (id is 1,2,3) then you want random 6 after that such that the 4 and beyond rows are not in 123
 
yeah
 
5:39 AM
yeah I got that one. Why don't you ask it as a question and see what ya get
 
5:59 AM
hmm, ok will ask it as a question, let's say have 10 products and in db have 3 cols, one is offer_type values (1 upto 9) 2nd col sequence values (1 upto 10) 3rd col is bottom (default value 0 but if 1 then the relative product must stay at bottom) and the goal is offer type always comes first, products without offers shuffle on page refresh and if any product (not offertype) has bottom value=1 must stay at bottom
 
you can ask any question you like. I was talking about the question we were talking about
 
that's the question we were talking about, i thought it would be simple but it's not, will be posting on SO shortly.
 
that is the question you thought we were talking about
not that I would answer it anyway. Wouldn't be fair. Wouldn't be sporting
 
6:33 AM
i thought 2 minds better then one so asked you and question posted stackoverflow.com/questions/33968471/…
i tried what you suggested and also couple of other solutions but end result is not as expected
 
7:12 AM
I wasn't really suggesting anything other than rand() in the first of the things you showed me, and mentioned that other guys solution, and every question is different. Gotta play with it
sometimes you have to be like a rocket scientist to get it to work. I would not expect anything that I type to lead anyone to an answer. I would have to just give it to them.
People that come here are mostly, completely lost. They aren't taking anything that I suggest as a road map for them to fix it
 
 
5 hours later…
crl
12:05 PM
<body>
..
below before
</body>
 
1 message moved from [JavaScript ](chat.stackoverflow.com/rooms/17/javascript)
 
 
7 hours later…
Tom
6:47 PM
@RishavKundu ping
 
Tom
6:59 PM
1 message moved from [Teenage Territory ](chat.stackoverflow.com/rooms/85048/teenage-territory)
 
 
2 hours later…
8:36 PM
 
1 message moved from SO Close Vote Reviewers
 

« first day (1038 days earlier)      last day (3064 days later) »