In SPARQL, we can group the rows by a column through the gollowing syntax:
GROUP BY ?colName
Can we group by more than 1 columns eg:
GROUP BY (?colName1 + ?colName2 + ?colName3)
Suppose a query like:
Select ?a ?b ?c (MIN(?y) AS ?d)
Where {
....
}
GROUP BY (?a + ?b + ?c)
But this query does not work.
You can GROUP BY
multiple variables (not columns) by listing them with a space in between:
GROUP BY ?a ?b ?c
In addition to Ben Companjen's answer of
GROUP BY ?a ?b ?c
you need to fix the SELECT line as you can't pass out the indeterminate non-group keys without explicitly saying so e.g.
SELECT (sample(?a) as ?A) (sample(?b) as ?B) (sample(?c) as ?C) (min(?y) as ?d)
Have you tried something like
SELECT ?a+b+?c, (MIN(?y) AS ?d)
Where {
....
}
GROUP BY (?a+?b+?c)
This works in SQL Server just fine