2015-11-04 2 views
1

Я использую OrientDB 2.1.4. Является ли пункт HAVING теперь доступным с помощью GROUP BY? Ниже мой запрос, можно ли его еще уменьшить?Имея пункт в OrientDB

select CardName, CardCount from (select CardName, sum(Count) as CardCount from (select inV().Name as CardName, outV().ActiveSessionCount as Count from RealizedBy) group by CardName) where CardCount > 1 

Команда экспорта схемы дает выход, как указано ниже:

{"info":{"name":"Smarts","default-cluster-id":3,"exporter-version":11,"engine-version":"2.1.4","engine-build":"[email protected]${buildNumber}; 2015-10-13 12:23:58+0000","storage-config-version":14,"schema-version":4,"mvrbtree-version":3,"schemaRecordId":"#0:1","indexMgrRecordId":"#0:2"},"clusters":[{"name":"internal","id":0},{"name":"index","id":1},{"name":"manindex","id":2},{"name":"default","id":3},{"name":"orole","id":4},{"name":"ouser","id":5},{"name":"ofunction","id":6},{"name":"oschedule","id":7},{"name":"orids","id":8},{"name":"v","id":9},{"name":"e","id":10},{"name":"_studio","id":11},{"name":"device","id":12},{"name":"card","id":13},{"name":"port","id":14},{"name":"vp","id":15},{"name":"configuredon","id":16},{"name":"realizedby","id":17},{"name":"connectedto","id":18},{"name":"composedof","id":19}],"schema":{"version":2,"classes":[{"name":"Card","default-cluster-id":13,"cluster-ids":[13],"oversize":0.0,"super-classes":["V"],"cluster-selection":"round-robin","properties":[{"name":"ActiveSessionCount","type":"INTEGER","collate":"default"},{"name":"Name","type":"STRING","collate":"default"},{"name":"TotalSessionCount","type":"INTEGER","collate":"default"}]},{"name":"Composedof","default-cluster-id":19,"cluster-ids":[19],"super-classes":["E"],"cluster-selection":"round-robin"},{"name":"ConfiguredOn","default-cluster-id":16,"cluster-ids":[16],"super-classes":["E"],"cluster-selection":"round-robin"},{"name":"ConnectedTo","default-cluster-id":18,"cluster-ids":[18],"super-classes":["E"],"cluster-selection":"round-robin"},{"name":"Device","default-cluster-id":12,"cluster-ids":[12],"oversize":0.0,"super-classes":["V"],"cluster-selection":"round-robin","properties":[{"name":"ActiveSessionCount","type":"INTEGER","collate":"default"},{"name":"Name","type":"STRING","collate":"default"},{"name":"TotalSessionCount","type":"INTEGER","collate":"default"},{"name":"Type","type":"STRING","collate":"default"}]},{"name":"E","default-cluster-id":10,"cluster-ids":[10],"cluster-selection":"round-robin"},{"name":"OFunction","default-cluster-id":6,"cluster-ids":[6],"cluster-selection":"round-robin","properties":[{"name":"code","type":"STRING","collate":"default"},{"name":"idempotent","type":"BOOLEAN","collate":"default"},{"name":"language","type":"STRING","collate":"default"},{"name":"name","type":"STRING","collate":"default"},{"name":"parameters","type":"EMBEDDEDLIST","linked-type":"STRING","collate":"default"}]},{"name":"OIdentity","default-cluster-id":-1,"cluster-ids":[-1],"abstract":true,"cluster-selection":"round-robin"},{"name":"ORIDs","default-cluster-id":8,"cluster-ids":[8],"cluster-selection":"round-robin"},{"name":"ORestricted","default-cluster-id":-1,"cluster-ids":[-1],"abstract":true,"cluster-selection":"round-robin","properties":[{"name":"_allow","type":"LINKSET","linked-class":"OIdentity","collate":"default"},{"name":"_allowDelete","type":"LINKSET","linked-class":"OIdentity","collate":"default"},{"name":"_allowRead","type":"LINKSET","linked-class":"OIdentity","collate":"default"},{"name":"_allowUpdate","type":"LINKSET","linked-class":"OIdentity","collate":"default"}]},{"name":"ORole","default-cluster-id":4,"cluster-ids":[4],"super-classes":["OIdentity"],"cluster-selection":"round-robin","properties":[{"name":"inheritedRole","type":"LINK","linked-class":"ORole","collate":"default"},{"name":"mode","type":"BYTE","collate":"default"},{"name":"name","type":"STRING","mandatory":true,"not-null":true,"collate":"ci"},{"name":"rules","type":"EMBEDDEDMAP","linked-type":"BYTE","collate":"default"}]},{"name":"OSchedule","default-cluster-id":7,"cluster-ids":[7],"cluster-selection":"round-robin","properties":[{"name":"arguments","type":"EMBEDDEDMAP","collate":"default"},{"name":"function","type":"LINK","mandatory":true,"not-null":true,"linked-class":"OFunction","collate":"default"},{"name":"name","type":"STRING","mandatory":true,"not-null":true,"collate":"default"},{"name":"rule","type":"STRING","mandatory":true,"not-null":true,"collate":"default"},{"name":"start","type":"BOOLEAN","collate":"default"},{"name":"starttime","type":"DATETIME","collate":"default"},{"name":"status","type":"STRING","collate":"default"}]},{"name":"OTriggered","default-cluster-id":-1,"cluster-ids":[-1],"abstract":true,"cluster-selection":"round-robin"},{"name":"OUser","default-cluster-id":5,"cluster-ids":[5],"super-classes":["OIdentity"],"cluster-selection":"round-robin","properties":[{"name":"name","type":"STRING","mandatory":true,"not-null":true,"collate":"ci"},{"name":"password","type":"STRING","mandatory":true,"not-null":true,"collate":"default"},{"name":"roles","type":"LINKSET","linked-class":"ORole","collate":"default"},{"name":"status","type":"STRING","mandatory":true,"not-null":true,"collate":"default"}]},{"name":"Port","default-cluster-id":14,"cluster-ids":[14],"oversize":0.0,"super-classes":["V"],"cluster-selection":"round-robin","properties":[{"name":"ActiveSessionCount","type":"INTEGER","collate":"default"},{"name":"Name","type":"STRING","collate":"default"},{"name":"TotalSessionCount","type":"INTEGER","collate":"default"}]},{"name":"RealizedBy","default-cluster-id":17,"cluster-ids":[17],"super-classes":["E"],"cluster-selection":"round-robin"},{"name":"V","default-cluster-id":9,"cluster-ids":[9],"oversize":2.0,"cluster-selection":"round-robin"},{"name":"VP","default-cluster-id":15,"cluster-ids":[15],"oversize":0.0,"super-classes":["V"],"cluster-selection":"round-robin","properties":[{"name":"ActiveSessionCount","type":"INTEGER","collate":"default"},{"name":"Name","type":"STRING","collate":"default"},{"name":"TotalSessionCount","type":"INTEGER","collate":"default"}]},{"name":"_studio","default-cluster-id":11,"cluster-ids":[11],"cluster-selection":"round-robin"}]},"indexes":[{"name":"dictionary","type":"DICTIONARY","algorithm":"SBTREE","definition":{"defClass":"com.orientechnologies.orient.core.index.OSimpleKeyIndexDefinition","stream":{"@type":"d","@version":0,"keyTypes":["STRING"],"collate":"default","nullValuesIgnored":true}},"metadata":{"@type":"d","@version":0,"durableInNonTxMode":true,"trackMode":"FULL"}},{"name":"Device.Name","type":"UNIQUE","algorithm":"SBTREE","clustersToIndex":["device"],"definition":{"defClass":"com.orientechnologies.orient.core.index.OPropertyIndexDefinition","stream":{"@type":"d","@version":0,"className":"Device","field":"Name","keyType":"STRING","collate":"default","nullValuesIgnored":true}}},{"name":"OUser.name","type":"UNIQUE","algorithm":"SBTREE","clustersToIndex":["ouser"],"definition":{"defClass":"com.orientechnologies.orient.core.index.OPropertyIndexDefinition","stream":{"@type":"d","@version":0,"className":"OUser","field":"name","keyType":"STRING","collate":"ci","nullValuesIgnored":true}}},{"name":"ORole.name","type":"UNIQUE","algorithm":"SBTREE","clustersToIndex":["orole"],"definition":{"defClass":"com.orientechnologies.orient.core.index.OPropertyIndexDefinition","stream":{"@type":"d","@version":0,"className":"ORole","field":"name","keyType":"STRING","collate":"ci","nullValuesIgnored":true}}},{"name":"Card.Name","type":"UNIQUE","algorithm":"SBTREE","clustersToIndex":["card"],"definition":{"defClass":"com.orientechnologies.orient.core.index.OPropertyIndexDefinition","stream":{"@type":"d","@version":0,"className":"Card","field":"Name","keyType":"STRING","collate":"default","nullValuesIgnored":true}}},{"name":"VP.Name","type":"UNIQUE","algorithm":"SBTREE","clustersToIndex":["vp"],"definition":{"defClass":"com.orientechnologies.orient.core.index.OPropertyIndexDefinition","stream":{"@type":"d","@version":0,"className":"VP","field":"Name","keyType":"STRING","collate":"default","nullValuesIgnored":true}}},{"name":"Port.Name","type":"UNIQUE","algorithm":"SBTREE","clustersToIndex":["port"],"definition":{"defClass":"com.orientechnologies.orient.core.index.OPropertyIndexDefinition","stream":{"@type":"d","@version":0,"className":"Port","field":"Name","keyType":"STRING","collate":"default","nullValuesIgnored":true}}}],"manualIndexes":[{"name":"dictionary","content":[]}]} 

ответ

0

Нет, текущая версия OrientDB не поддерживает предложения HAVING. Вероятно, он будет представлен в следующих выпусках, но это не является первоочередной задачей в дорожной карте

+0

Подумайте, какую версию она будет представлена? –

Смежные вопросы