> > is it possible with CQL do something like a GROUP BY in SQL?
> > 
> > Imagine the  case you want determine how many times a special opening
> > was played in 1900, 1901, 1902 ...
> 
> Hmmm.... results can always be grouped-by using the gamelist sort feature.
> But a proper resolved query would need a "count" feature... and rewriting
> SQL is probably beyond the scope of the project. ! :)

Although it is named Chess Query Language, it is quite different from 
Structured Query Language. The former is designed especially for the purposes 
of position search, the latter is designed especially for managing/retrieving 
data in relational databases. Some functionality of SQL may overburden CQL. So 
I agree with Steve that some functions will be performed with "normal" 
functionality, probably combined with position search (pre-filtering the 
gamelist).

But the newer CQL 5.1 version indeed provides a sorting functionality. See 
this simplified example in CQL-S:

--------------------------------------------------------------------------------------
; match with a specific ECO code (312 == "C12", we need numbers here)
; function #eco retrieves the eco code from current game
:matchnumber 312 #eco

; sort by content of this block (event year)
:sort (
    ; match event dates starting with year 1900 until present
    ; function #eventdate retrieves the event year from current game
    #matchnumber >=1900 #eventdate
)
--------------------------------------------------------------------------------------

So the search will give the results sorted by event year. This sorting 
functionality has no (significant) impact on the speed of the search, and can 
be specified for any sortable data. Even sorting on position match count is 
possible.

But this example is not giving a count per year, and is not sorting by group. 
This would require something like:

--------------------------------------------------------------------------------------
; start with year 1900
; function #eventdate retrieves the event year from current game
#matchnumber >=1900 #eventdate

; sort by number of hits per year, the {...} block gives the number of matches
:sortby (#eventdate) {
    ; match with a specific ECO code (312 == "C12", we need numbers here)
    ; function #eco retrieves the eco code from current game
    :matchnumber 312 #eco
}
--------------------------------------------------------------------------------------

Currently it's not yet clear whether this will belong to CQL, such 
sophisticated functions needs more-in-depth analysis.

Gregor

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Scidb-users mailing list
Scidb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scidb-users

Reply via email to