12aggr.mql 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. -- ============================================================
  2. -- 子查询+聚合测试(跳过:服务器 parser 不支持子查询)
  3. -- ============================================================
  4. -- 1. 子查询中用聚合函数(服务器可能不支持 > (select ...))
  5. select * from /test/aaa/test_subquery where s_value > (select avg(s_value) from /test/aaa/test_subquery)
  6. /**
  7. onerror(continue,"After '","(select")
  8. output()
  9. **/
  10. ;
  11. -- 2. 子查询中用 count(服务器不支持 IN (select ...))
  12. select * from /test/aaa/test_subquery where s_type in (select s_type from /test/aaa/test_subquery group by s_type having count(*) > 1)
  13. /**
  14. onerror(continue,"After '","s_type in ('")
  15. output()
  16. **/
  17. ;
  18. -- 3. 子查询 group by(服务器可能不支持 > (select ...))
  19. select s_type, count(*) from /test/aaa/test_subquery where s_value > (select min(s_value) from /test/aaa/test_subquery where s_type='type_x') group by s_type
  20. /**
  21. onerror(continue,"After '","(select")
  22. output()
  23. **/
  24. ;
  25. -- 4. 子查询嵌套的聚合(服务器不支持 IN (select ...))
  26. select max(s_value) from /test/aaa/test_subquery where s_type in (select s_type from /test/aaa/test_subquery)
  27. /**
  28. onerror(continue,"After '","s_type in ('")
  29. output()
  30. **/
  31. ;