Skip to main content
15 events
when toggle format what by license comment
Apr 13, 2017 at 12:42 history edited CommunityBot
replaced http://dba.stackexchange.com/ with https://dba.stackexchange.com/
Apr 9, 2011 at 0:00 history bounty ended Michael McGowan
Apr 5, 2011 at 18:30 answer added dba4life timeline score: 0
Apr 5, 2011 at 0:36 answer added Michael McGowan timeline score: 1
Apr 2, 2011 at 19:37 comment added Michael McGowan @jcolebrand It may well be that I shouldn't be doing this in SQL, but I thought a useful rule of thumb was to let the database do the work for you. I'm still learning the bounds of what should and should not be processed within the database, but in the past when I've tried pulling out results, processing them, and then sticking the results back in, I've gotten poor performance results (hours and hours because I was probably doing something wrong in inserting the results back in).
Apr 2, 2011 at 13:44 answer added nabrond timeline score: 5
Apr 2, 2011 at 6:06 comment added jcolebrand I still think a sample TABLE in the question would be helpful. But I think I see what you want. I just don't see where those things are the domain of SQL, since it's not really about sets. SQL is the domain of sets. I would do the logic you're suggesting in a php file with a single (or two) loops. SQL would be doing an effective single loop to assign the numbers anyways.
Apr 2, 2011 at 3:05 comment added Michael McGowan @jcolebrand Suppose I also had a weight column. I might want to take the average weight of mammals with IDs from 1-10 and the average weight of mammals with IDs from 11-20, etc. That is the sense that I want to GROUP BY. I might then want to pair groups of 10 to find the correlation between the average. I need this random ordering because if the original insertion order happened to be sorted by weight then this would give me the wrong results. I hope I'm making sense.
Apr 2, 2011 at 3:01 comment added Michael McGowan @jcolebrand For every record that is a mammal I want to assign a unique id from 1 to numMammal. I don't really care what id dog gets, but I do not want it to depend upon the original insertion order.
Apr 2, 2011 at 2:39 comment added jcolebrand I would want that initial ordering to be random, but then deterministic from then out. <-- say what? I think no matter what you do you're going to have to put the records in a second table of some sort. How precisely does this business logic work? As is there's nothing to require (for example) dog to come first. And what do you mean by I would want the records from *mammal* to have one "group" for IDs 1-10, and another for IDs 11-20 ... can you illustrate that with another table, focusing on mammals, in the above question description?
Apr 2, 2011 at 0:04 history bounty started Michael McGowan
Mar 31, 2011 at 23:58 history edited Michael McGowan CC BY-SA 2.5
added example and added sql tag
Mar 28, 2011 at 11:23 history tweeted twitter.com/#!/StackDBAs/status/52329994134880256
Mar 28, 2011 at 5:39 answer added gbn timeline score: 2
Mar 28, 2011 at 5:23 history asked Michael McGowan CC BY-SA 2.5