I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
well one way to do it would be to make a query seelction the TOP 2 (or 3) then make another query which selects the TOP 1 FROM that query but now soring the other way. and I am sure it could be done in one single SQL too :o)
Vilhelm>After taking a closer look at your question thn I think its best to say that it isnt easy although possible! The first and last functions select the first or last values of the set of records. In other words if you GROUP by a number of fields then you have to make a query which finds the n'th value of ALL the records included in each SET. The first and last functions are buildt into the SQL language and I could imagine that when the SQL gets run then it looks at it and see's that you have a GROUPING then makes a sub SELECT taking either the TOP 1 sorted ascending or TOP 1 sorted descending and using each field in the grouping as the WHERE. Because we dont have access to the SQL compiler we would have to do all of this manually, changing the code each time we change the fields we are grouping on. But I guess its possible (at a price :o) )
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.