Explorar el Código

count distinct

wecisecode hace 1 día
padre
commit
81988f3596
Se han modificado 2 ficheros con 46 adiciones y 0 borrados
  1. 35 0
      odbctest/mql/basic/10basic/52count.mql
  2. 11 0
      odbctest/mql/uino/061.mql

+ 35 - 0
odbctest/mql/basic/10basic/52count.mql

@@ -53,6 +53,17 @@ match('文字','a',count,1)
 **/
 ;
 
+select count(distinct *), v_chars as "文字" from /test/foo 
+group by v_chars having count(distinct *) > 1 and count(distinct id) < 4
+order by "文字" desc
+/**
+output()
+count(2)
+match('文字','c',count,3)
+match('文字','b',count,2)
+**/
+;
+
 select count(distinct id), v_chars as "文字" from /test/foo 
 group by v_chars order by "文字" desc
 /**
@@ -64,6 +75,18 @@ match('文字','a',count,1)
 **/
 ;
 
+
+select count(distinct id), v_chars as "文字" from /test/foo 
+group by v_chars having count(distinct id) > 2
+order by "文字" desc
+/**
+output()
+count(2)
+match('文字','d',count,4)
+match('文字','c',count,3)
+**/
+;
+
 select count(distinct v_chars), v_chars as "文字" from /test/foo 
 group by v_chars order by "文字" desc
 /**
@@ -158,6 +181,18 @@ match('文字','a',count,1)
 **/
 ;
 
+select count(distinct id), v_chars as "文字" from
+(select * from /test/foo) xx
+group by v_chars having count(distinct id) > 2
+order by "文字" desc
+/**
+output()
+count(2)
+match('文字','d',count,4)
+match('文字','c',count,3)
+**/
+;
+
 select count(distinct v_chars), v_chars as "文字" from
 (select * from /test/foo) xx
 group by v_chars order by "文字" desc

+ 11 - 0
odbctest/mql/uino/061.mql

@@ -0,0 +1,11 @@
+
+
+
+SELECT count(temp01.member_id) AS "member_count", temp01.member_id 
+FROM 
+ (MATCH (company:/apoc/company)
+ -[:company_member_info_rel*1..1]->
+ (member:/apoc/member_info WHERE member_term_start <= '2026-03-30' AND member_term_end >= '2026-03-30') 
+ RETURN member.member_id_no AS "member_id", company.unified_social_credit_code AS "company_code") temp01
+ GROUP BY temp01."member_id" HAVING count(DISTINCT temp01."company_code") > 1 
+ LIMIT 0, 20000 WITH TIMEOUT = 6m