52count.mql 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. select count(), v_chars as "文字" from /test/foo
  2. group by v_chars order by "文字" desc
  3. /**
  4. output()
  5. match('文字','d',count,4)
  6. match('文字','c',count,3)
  7. match('文字','b',count,2)
  8. match('文字','a',count,1)
  9. **/
  10. ;
  11. select count(*), v_chars as "文字" from /test/foo
  12. group by v_chars order by "文字" desc
  13. /**
  14. output()
  15. match('文字','d',count,4)
  16. match('文字','c',count,3)
  17. match('文字','b',count,2)
  18. match('文字','a',count,1)
  19. **/
  20. ;
  21. select count(id), v_chars as "文字" from /test/foo
  22. group by v_chars order by "文字" desc
  23. /**
  24. output()
  25. match('文字','d',count,4)
  26. match('文字','c',count,3)
  27. match('文字','b',count,2)
  28. match('文字','a',count,1)
  29. **/
  30. ;
  31. -- 不支持这种写法 distinct 后面必须带字段名
  32. select count(distinct), v_chars as "文字" from /test/foo
  33. group by v_chars order by "文字" desc
  34. /**
  35. onerror(continue,"not exist")
  36. noerrinfo()
  37. **/
  38. ;
  39. select count(distinct *), v_chars as "文字" from /test/foo
  40. group by v_chars order by "文字" desc
  41. /**
  42. output()
  43. match('文字','d',count,4)
  44. match('文字','c',count,3)
  45. match('文字','b',count,2)
  46. match('文字','a',count,1)
  47. **/
  48. ;
  49. select count(distinct id), v_chars as "文字" from /test/foo
  50. group by v_chars order by "文字" desc
  51. /**
  52. output()
  53. match('文字','d',count,4)
  54. match('文字','c',count,3)
  55. match('文字','b',count,2)
  56. match('文字','a',count,1)
  57. **/
  58. ;
  59. select count(distinct v_chars), v_chars as "文字" from /test/foo
  60. group by v_chars order by "文字" desc
  61. /**
  62. output()
  63. match('文字','d',count,1)
  64. match('文字','c',count,1)
  65. match('文字','b',count,1)
  66. match('文字','a',count,1)
  67. **/
  68. ;
  69. select count(distinct xx.v_chars), xx.v_chars as "文字" from /test/foo xx
  70. group by xx.v_chars order by "文字" desc
  71. /**
  72. output()
  73. match('文字','d',count,1)
  74. match('文字','c',count,1)
  75. match('文字','b',count,1)
  76. match('文字','a',count,1)
  77. **/
  78. ;
  79. select count(), v_chars as "文字" from
  80. (select * from /test/foo) xx
  81. group by v_chars order by "文字" desc
  82. /**
  83. output()
  84. match('文字','d',count,4)
  85. match('文字','c',count,3)
  86. match('文字','b',count,2)
  87. match('文字','a',count,1)
  88. **/
  89. ;
  90. select count(*), v_chars as "文字" from
  91. (select * from /test/foo) xx
  92. group by v_chars order by "文字" desc
  93. /**
  94. output()
  95. match('文字','d',count,4)
  96. match('文字','c',count,3)
  97. match('文字','b',count,2)
  98. match('文字','a',count,1)
  99. **/
  100. ;
  101. select count(id), v_chars as "文字" from
  102. (select * from /test/foo) xx
  103. group by v_chars order by "文字" desc
  104. /**
  105. output()
  106. match('文字','d',count,4)
  107. match('文字','c',count,3)
  108. match('文字','b',count,2)
  109. match('文字','a',count,1)
  110. **/
  111. ;
  112. select count(distinct), v_chars as "文字" from
  113. (select v_chars, id as distinct from /test/foo) xx
  114. group by v_chars order by "文字" desc
  115. /**
  116. output()
  117. match('文字','d',count,4)
  118. match('文字','c',count,3)
  119. match('文字','b',count,2)
  120. match('文字','a',count,1)
  121. **/
  122. ;
  123. select count(distinct *), v_chars as "文字" from
  124. (select * from /test/foo) xx
  125. group by v_chars order by "文字" desc
  126. /**
  127. output()
  128. match('文字','d',count,4)
  129. match('文字','c',count,3)
  130. match('文字','b',count,2)
  131. match('文字','a',count,1)
  132. **/
  133. ;
  134. select count(distinct id), v_chars as "文字" from
  135. (select * from /test/foo) xx
  136. group by v_chars order by "文字" desc
  137. /**
  138. output()
  139. match('文字','d',count,4)
  140. match('文字','c',count,3)
  141. match('文字','b',count,2)
  142. match('文字','a',count,1)
  143. **/
  144. ;
  145. select count(distinct v_chars), v_chars as "文字" from
  146. (select * from /test/foo) xx
  147. group by v_chars order by "文字" desc
  148. /**
  149. output()
  150. match('文字','d',count,1)
  151. match('文字','c',count,1)
  152. match('文字','b',count,1)
  153. match('文字','a',count,1)
  154. **/
  155. ;
  156. select count(distinct xx.v_chars), xx.v_chars as "文字" from
  157. (select * from /test/foo) xx
  158. group by xx.v_chars order by "文字" desc
  159. /**
  160. output()
  161. match('文字','d',count,1)
  162. match('文字','c',count,1)
  163. match('文字','b',count,1)
  164. match('文字','a',count,1)
  165. **/
  166. ;