ServiceStack MAX and MIN query -
being relatively new servicestack, not sure how this...
i have object called nexthint provides hint user.
[autoincrement] public int id { get; set; } public string body { get; set; } public string title { get; set; } public int votecount { get; set; } public int timesshown { get; set; }
i trying find hint has highest number of votes (max(votecount)) , has been least seen (min(timesshown)). rationale of logic not point here rather sql mechanics.
my method looks like...
public object get(nexthint request) { hint hint; using (var db = dbconnectionfactory.opendbconnection()) { //don't know here!!! db.single<hint>("min(timesshown) , max(votecount) group id"); //update count of timesshown hint.timesshown++; db.update(hint); } return new nexthintresponse { title = hint.title, body = hint.body }; }
could point me in right direction? btw - using mysql solution remain generic.
Comments
Post a Comment