当前位置:   article > 正文

MySQL 聚合函数_sql里面的if grouping

sql里面的if grouping
名称描述
AVG()返回参数的平均值
BIT_AND()按位和返回
BIT_OR()按位返回或
BIT_XOR()返回位异或
COUNT()返回返回的行数的计数
COUNT(DISTINCT)返回多个不同值的计数
GROUP_CONCAT()返回连接的字符串
JSON_ARRAYAGG()以单个JSON数组的形式返回结果集
JSON_OBJECTAGG()将结果集作为单个JSON对象返回
MAX()返回最大值
MIN()返回最小值
STD()返回总体标准偏差
STDDEV()返回总体标准偏差
STDDEV_POP()返回总体标准偏差
STDDEV_SAMP()返回样本标准偏差
SUM()退还金额
VAR_POP()返回总体标准方差
VAR_SAMP()返回样本方差
VARIANCE()返回总体标准方差
  1. SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(time_col))) FROM tbl_name;
  2. SELECT FROM_DAYS(SUM(TO_DAYS(date_col))) FROM tbl_name;
  3. mysql> SELECT student_name, AVG(test_score)
  4. FROM student
  5. GROUP BY student_name;
  6. mysql> SELECT student.student_name,COUNT(*)
  7. FROM student,course
  8. WHERE student.student_id=course.student_id
  9. GROUP BY student_name;
  10. mysql> SELECT COUNT(*) FROM student;
  11. mysql> SELECT COUNT(DISTINCT results) FROM student;
  12. mysql> SELECT student_name,
  13. GROUP_CONCAT(test_score)
  14. FROM student
  15. GROUP BY student_name;
  16. mysql> SELECT student_name,
  17. GROUP_CONCAT(DISTINCT test_score
  18. ORDER BY test_score DESC SEPARATOR ' ')
  19. FROM student
  20. GROUP BY student_name;
  21. mysql> SELECT o_id, attribute, value FROM t3;
  22. +------+-----------+-------+
  23. | o_id | attribute | value |
  24. +------+-----------+-------+
  25. | 2 | color | red |
  26. | 2 | fabric | silk |
  27. | 3 | color | green |
  28. | 3 | shape | square|
  29. +------+-----------+-------+
  30. 4 rows in set (0.00 sec)
  31. mysql> SELECT o_id, JSON_ARRAYAGG(attribute) AS attributes
  32. > FROM t3 GROUP BY o_id;
  33. +------+---------------------+
  34. | o_id | attributes |
  35. +------+---------------------+
  36. | 2 | ["color", "fabric"] |
  37. | 3 | ["color", "shape"] |
  38. +------+---------------------+
  39. 2 rows in set (0.00 sec)
  40. mysql> SELECT o_id, attribute, value FROM t3;
  41. +------+-----------+-------+
  42. | o_id | attribute | value |
  43. +------+-----------+-------+
  44. | 2 | color | red |
  45. | 2 | fabric | silk |
  46. | 3 | color | green |
  47. | 3 | shape | square|
  48. +------+-----------+-------+
  49. 4 rows in set (0.00 sec)
  50. mysql> SELECT o_id, JSON_OBJECTAGG(attribute, value)
  51. > FROM t3 GROUP BY o_id;
  52. +------+---------------------------------------+
  53. | o_id | JSON_OBJECTAGG(attribute, value) |
  54. +------+---------------------------------------+
  55. | 2 | {"color": "red", "fabric": "silk"} |
  56. | 3 | {"color": "green", "shape": "square"} |
  57. +------+---------------------------------------+
  58. 2 rows in set (0.00 sec)
  59. mysql> CREATE TABLE t(c VARCHAR(10), i INT);
  60. Query OK, 0 rows affected (0.33 sec)
  61. mysql> INSERT INTO t VALUES ('key', 3), ('key', 4), ('key', 5);
  62. Query OK, 3 rows affected (0.10 sec)
  63. Records: 3 Duplicates: 0 Warnings: 0
  64. mysql> SELECT c, i FROM t;
  65. +------+------+
  66. | c | i |
  67. +------+------+
  68. | key | 3 |
  69. | key | 4 |
  70. | key | 5 |
  71. +------+------+
  72. 3 rows in set (0.00 sec)
  73. mysql> SELECT JSON_OBJECTAGG(c, i) FROM t;
  74. +----------------------+
  75. | JSON_OBJECTAGG(c, i) |
  76. +----------------------+
  77. | {"key": 5} |
  78. +----------------------+
  79. 1 row in set (0.00 sec)
  80. mysql> DELETE FROM t;
  81. Query OK, 3 rows affected (0.08 sec)
  82. mysql> INSERT INTO t VALUES ('key', 3), ('key', 5), ('key', 4);
  83. Query OK, 3 rows affected (0.06 sec)
  84. Records: 3 Duplicates: 0 Warnings: 0
  85. mysql> SELECT c, i FROM t;
  86. +------+------+
  87. | c | i |
  88. +------+------+
  89. | key | 3 |
  90. | key | 5 |
  91. | key | 4 |
  92. +------+------+
  93. 3 rows in set (0.00 sec)
  94. mysql> SELECT JSON_OBJECTAGG(c, i) FROM t;
  95. +----------------------+
  96. | JSON_OBJECTAGG(c, i) |
  97. +----------------------+
  98. | {"key": 4} |
  99. +----------------------+
  100. 1 row in set (0.00 sec)
  101. mysql> SELECT JSON_OBJECTAGG(c, i)
  102. OVER () AS json_object FROM t;
  103. +-------------+
  104. | json_object |
  105. +-------------+
  106. | {"key": 4} |
  107. | {"key": 4} |
  108. | {"key": 4} |
  109. +-------------+
  110. mysql> SELECT JSON_OBJECTAGG(c, i)
  111. OVER (ORDER BY i) AS json_object FROM t;
  112. +-------------+
  113. | json_object |
  114. +-------------+
  115. | {"key": 3} |
  116. | {"key": 4} |
  117. | {"key": 5} |
  118. +-------------+
  119. mysql> SELECT JSON_OBJECTAGG(c, i)
  120. OVER (ORDER BY i DESC) AS json_object FROM t;
  121. +-------------+
  122. | json_object |
  123. +-------------+
  124. | {"key": 5} |
  125. | {"key": 4} |
  126. | {"key": 3} |
  127. +-------------+
  128. mysql> SELECT JSON_OBJECTAGG(c, i)
  129. OVER (ORDER BY i
  130. ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
  131. AS json_object
  132. FROM t;
  133. +-------------+
  134. | json_object |
  135. +-------------+
  136. | {"key": 5} |
  137. | {"key": 5} |
  138. | {"key": 5} |
  139. +-------------+
  140. mysql> SELECT JSON_OBJECTAGG(c, i)
  141. OVER (ORDER BY i) AS json_object FROM t LIMIT 1;
  142. +-------------+
  143. | json_object |
  144. +-------------+
  145. | {"key": 3} |
  146. +-------------+
  147. mysql> SELECT JSON_OBJECTAGG(c, i)
  148. OVER (ORDER BY i DESC) AS json_object FROM t LIMIT 1;
  149. +-------------+
  150. | json_object |
  151. +-------------+
  152. | {"key": 5} |
  153. +-------------+
  154. mysql> SELECT student_name, MIN(test_score), MAX(test_score)
  155. FROM student
  156. GROUP BY student_name;
  157. mysql> SELECT student_name, MIN(test_score), MAX(test_score)
  158. FROM student
  159. GROUP BY student_name;
  160. CREATE TABLE sales
  161. (
  162. year INT,
  163. country VARCHAR(20),
  164. product VARCHAR(32),
  165. profit INT
  166. );
  167. mysql> SELECT year, SUM(profit) AS profit
  168. FROM sales
  169. GROUP BY year;
  170. +------+--------+
  171. | year | profit |
  172. +------+--------+
  173. | 2000 | 4525 |
  174. | 2001 | 3010 |
  175. +------+--------+
  176. mysql> SELECT year, SUM(profit) AS profit
  177. FROM sales
  178. GROUP BY year WITH ROLLUP;
  179. +------+--------+
  180. | year | profit |
  181. +------+--------+
  182. | 2000 | 4525 |
  183. | 2001 | 3010 |
  184. | NULL | 7535 |
  185. +------+--------+
  186. mysql> SELECT year, country, product, SUM(profit) AS profit
  187. FROM sales
  188. GROUP BY year, country, product;
  189. +------+---------+------------+--------+
  190. | year | country | product | profit |
  191. +------+---------+------------+--------+
  192. | 2000 | Finland | Computer | 1500 |
  193. | 2000 | Finland | Phone | 100 |
  194. | 2000 | India | Calculator | 150 |
  195. | 2000 | India | Computer | 1200 |
  196. | 2000 | USA | Calculator | 75 |
  197. | 2000 | USA | Computer | 1500 |
  198. | 2001 | Finland | Phone | 10 |
  199. | 2001 | USA | Calculator | 50 |
  200. | 2001 | USA | Computer | 2700 |
  201. | 2001 | USA | TV | 250 |
  202. +------+---------+------------+--------+
  203. mysql> SELECT year, country, product, SUM(profit) AS profit
  204. FROM sales
  205. GROUP BY year, country, product WITH ROLLUP;
  206. +------+---------+------------+--------+
  207. | year | country | product | profit |
  208. +------+---------+------------+--------+
  209. | 2000 | Finland | Computer | 1500 |
  210. | 2000 | Finland | Phone | 100 |
  211. | 2000 | Finland | NULL | 1600 |
  212. | 2000 | India | Calculator | 150 |
  213. | 2000 | India | Computer | 1200 |
  214. | 2000 | India | NULL | 1350 |
  215. | 2000 | USA | Calculator | 75 |
  216. | 2000 | USA | Computer | 1500 |
  217. | 2000 | USA | NULL | 1575 |
  218. | 2000 | NULL | NULL | 4525 |
  219. | 2001 | Finland | Phone | 10 |
  220. | 2001 | Finland | NULL | 10 |
  221. | 2001 | USA | Calculator | 50 |
  222. | 2001 | USA | Computer | 2700 |
  223. | 2001 | USA | TV | 250 |
  224. | 2001 | USA | NULL | 3000 |
  225. | 2001 | NULL | NULL | 3010 |
  226. | NULL | NULL | NULL | 7535 |
  227. +------+---------+------------+--------+
  228. mysql> SELECT
  229. year, country, product, SUM(profit) AS profit,
  230. GROUPING(year) AS grp_year,
  231. GROUPING(country) AS grp_country,
  232. GROUPING(product) AS grp_product
  233. FROM sales
  234. GROUP BY year, country, product WITH ROLLUP;
  235. +------+---------+------------+--------+----------+-------------+-------------+
  236. | year | country | product | profit | grp_year | grp_country | grp_product |
  237. +------+---------+------------+--------+----------+-------------+-------------+
  238. | 2000 | Finland | Computer | 1500 | 0 | 0 | 0 |
  239. | 2000 | Finland | Phone | 100 | 0 | 0 | 0 |
  240. | 2000 | Finland | NULL | 1600 | 0 | 0 | 1 |
  241. | 2000 | India | Calculator | 150 | 0 | 0 | 0 |
  242. | 2000 | India | Computer | 1200 | 0 | 0 | 0 |
  243. | 2000 | India | NULL | 1350 | 0 | 0 | 1 |
  244. | 2000 | USA | Calculator | 75 | 0 | 0 | 0 |
  245. | 2000 | USA | Computer | 1500 | 0 | 0 | 0 |
  246. | 2000 | USA | NULL | 1575 | 0 | 0 | 1 |
  247. | 2000 | NULL | NULL | 4525 | 0 | 1 | 1 |
  248. | 2001 | Finland | Phone | 10 | 0 | 0 | 0 |
  249. | 2001 | Finland | NULL | 10 | 0 | 0 | 1 |
  250. | 2001 | USA | Calculator | 50 | 0 | 0 | 0 |
  251. | 2001 | USA | Computer | 2700 | 0 | 0 | 0 |
  252. | 2001 | USA | TV | 250 | 0 | 0 | 0 |
  253. | 2001 | USA | NULL | 3000 | 0 | 0 | 1 |
  254. | 2001 | NULL | NULL | 3010 | 0 | 1 | 1 |
  255. | NULL | NULL | NULL | 7535 | 1 | 1 | 1 |
  256. +------+---------+------------+--------+----------+-------------+-------------+
  257. mysql> SELECT
  258. IF(GROUPING(year), 'All years', year) AS year,
  259. IF(GROUPING(country), 'All countries', country) AS country,
  260. IF(GROUPING(product), 'All products', product) AS product,
  261. SUM(profit) AS profit
  262. FROM sales
  263. GROUP BY year, country, product WITH ROLLUP;
  264. +-----------+---------------+--------------+--------+
  265. | year | country | product | profit |
  266. +-----------+---------------+--------------+--------+
  267. | 2000 | Finland | Computer | 1500 |
  268. | 2000 | Finland | Phone | 100 |
  269. | 2000 | Finland | All products | 1600 |
  270. | 2000 | India | Calculator | 150 |
  271. | 2000 | India | Computer | 1200 |
  272. | 2000 | India | All products | 1350 |
  273. | 2000 | USA | Calculator | 75 |
  274. | 2000 | USA | Computer | 1500 |
  275. | 2000 | USA | All products | 1575 |
  276. | 2000 | All countries | All products | 4525 |
  277. | 2001 | Finland | Phone | 10 |
  278. | 2001 | Finland | All products | 10 |
  279. | 2001 | USA | Calculator | 50 |
  280. | 2001 | USA | Computer | 2700 |
  281. | 2001 | USA | TV | 250 |
  282. | 2001 | USA | All products | 3000 |
  283. | 2001 | All countries | All products | 3010 |
  284. | All years | All countries | All products | 7535 |
  285. +-----------+---------------+--------------+--------+
  286. mysql> SELECT year, country, product, SUM(profit) AS profit
  287. FROM sales
  288. GROUP BY year, country, product WITH ROLLUP
  289. HAVING GROUPING(year, country, product) <> 0;
  290. +------+---------+---------+--------+
  291. | year | country | product | profit |
  292. +------+---------+---------+--------+
  293. | 2000 | Finland | NULL | 1600 |
  294. | 2000 | India | NULL | 1350 |
  295. | 2000 | USA | NULL | 1575 |
  296. | 2000 | NULL | NULL | 4525 |
  297. | 2001 | Finland | NULL | 10 |
  298. | 2001 | USA | NULL | 3000 |
  299. | 2001 | NULL | NULL | 3010 |
  300. | NULL | NULL | NULL | 7535 |
  301. +------+---------+---------+--------+
  302. mysql> SELECT * FROM t1;
  303. +------+-------+----------+
  304. | name | size | quantity |
  305. +------+-------+----------+
  306. | ball | small | 10 |
  307. | ball | large | 20 |
  308. | ball | NULL | 5 |
  309. | hoop | small | 15 |
  310. | hoop | large | 5 |
  311. | hoop | NULL | 3 |
  312. +------+-------+----------+
  313. mysql> SELECT name, size, SUM(quantity) AS quantity
  314. FROM t1
  315. GROUP BY name, size WITH ROLLUP;
  316. +------+-------+----------+
  317. | name | size | quantity |
  318. +------+-------+----------+
  319. | ball | NULL | 5 |
  320. | ball | large | 20 |
  321. | ball | small | 10 |
  322. | ball | NULL | 35 |
  323. | hoop | NULL | 3 |
  324. | hoop | large | 5 |
  325. | hoop | small | 15 |
  326. | hoop | NULL | 23 |
  327. | NULL | NULL | 58 |
  328. +------+-------+----------+
  329. mysql> SELECT
  330. IF(GROUPING(name) = 1, 'All items', name) AS name,
  331. IF(GROUPING(size) = 1, 'All sizes', size) AS size,
  332. SUM(quantity) AS quantity
  333. FROM t1
  334. GROUP BY name, size WITH ROLLUP;
  335. +-----------+-----------+----------+
  336. | name | size | quantity |
  337. +-----------+-----------+----------+
  338. | ball | NULL | 5 |
  339. | ball | large | 20 |
  340. | ball | small | 10 |
  341. | ball | All sizes | 35 |
  342. | hoop | NULL | 3 |
  343. | hoop | large | 5 |
  344. | hoop | small | 15 |
  345. | hoop | All sizes | 23 |
  346. | All items | All sizes | 58 |
  347. +-----------+-----------+----------+
  348. mysql> SELECT * FROM
  349. (SELECT year, SUM(profit) AS profit
  350. FROM sales GROUP BY year WITH ROLLUP) AS dt
  351. ORDER BY year DESC;
  352. +------+--------+
  353. | year | profit |
  354. +------+--------+
  355. | 2001 | 3010 |
  356. | 2000 | 4525 |
  357. | NULL | 7535 |
  358. +------+--------+
  359. mysql> SELECT year, SUM(profit) AS profit
  360. FROM sales
  361. GROUP BY year WITH ROLLUP
  362. ORDER BY GROUPING(year) DESC;
  363. +------+--------+
  364. | year | profit |
  365. +------+--------+
  366. | NULL | 7535 |
  367. | 2000 | 4525 |
  368. | 2001 | 3010 |
  369. +------+--------+
  370. mysql> SELECT year, country, product, SUM(profit) AS profit
  371. FROM sales
  372. GROUP BY year, country, product WITH ROLLUP
  373. LIMIT 5;
  374. +------+---------+------------+--------+
  375. | year | country | product | profit |
  376. +------+---------+------------+--------+
  377. | 2000 | Finland | Computer | 1500 |
  378. | 2000 | Finland | Phone | 100 |
  379. | 2000 | Finland | NULL | 1600 |
  380. | 2000 | India | Calculator | 150 |
  381. | 2000 | India | Computer | 1200 |
  382. +------+---------+------------+--------+
  383. mysql> SELECT year, country, SUM(profit) AS profit
  384. FROM sales
  385. GROUP BY year WITH ROLLUP;
  386. +------+---------+--------+
  387. | year | country | profit |
  388. +------+---------+--------+
  389. | 2000 | India | 4525 |
  390. | 2001 | USA | 3010 |
  391. | NULL | USA | 7535 |
  392. +------+---------+--------+
  393. mysql> SELECT year, ANY_VALUE(country) AS country, SUM(profit) AS profit
  394. FROM sales
  395. GROUP BY year WITH ROLLUP;
  396. +------+---------+--------+
  397. | year | country | profit |
  398. +------+---------+--------+
  399. | 2000 | India | 4525 |
  400. | 2001 | USA | 3010 |
  401. | NULL | USA | 7535 |
  402. +------+---------+--------+
  403. SELECT o.custid, c.name, MAX(o.payment)
  404. FROM orders AS o, customers AS c
  405. WHERE o.custid = c.custid
  406. GROUP BY o.custid;
  407. mysql> CREATE TABLE mytable (
  408. -> id INT UNSIGNED NOT NULL PRIMARY KEY,
  409. -> a VARCHAR(10),
  410. -> b INT
  411. -> );
  412. mysql> INSERT INTO mytable
  413. -> VALUES (1, 'abc', 1000),
  414. -> (2, 'abc', 2000),
  415. -> (3, 'def', 4000);
  416. mysql> SET SESSION sql_mode = sys.list_add(@@session.sql_mode, 'ONLY_FULL_GROUP_BY');
  417. mysql> SELECT a, SUM(b) FROM mytable WHERE a = 'abc';
  418. +------+--------+
  419. | a | SUM(b) |
  420. +------+--------+
  421. | abc | 3000 |
  422. +------+--------+
  423. mysql> DROP TABLE IF EXISTS mytable;
  424. mysql> CREATE TABLE mytable (
  425. -> id INT UNSIGNED NOT NULL PRIMARY KEY,
  426. -> a VARCHAR(10),
  427. -> b VARCHAR(10),
  428. -> c INT
  429. -> );
  430. mysql> INSERT INTO mytable
  431. -> VALUES (1, 'abc', 'qrs', 1000),
  432. -> (2, 'abc', 'tuv', 2000),
  433. -> (3, 'def', 'qrs', 4000),
  434. -> (4, 'def', 'tuv', 8000),
  435. -> (5, 'abc', 'qrs', 16000),
  436. -> (6, 'def', 'tuv', 32000);
  437. mysql> SELECT @@session.sql_mode;
  438. +---------------------------------------------------------------+
  439. | @@session.sql_mode |
  440. +---------------------------------------------------------------+
  441. | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
  442. +---------------------------------------------------------------+
  443. mysql> SELECT a, b, SUM(c) FROM mytable
  444. -> WHERE a = 'abc' AND b = 'qrs';
  445. +------+------+--------+
  446. | a | b | SUM(c) |
  447. +------+------+--------+
  448. | abc | qrs | 17000 |
  449. +------+------+--------+
  450. mysql> SELECT name, address, MAX(age) FROM t GROUP BY name;
  451. ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP
  452. BY clause and contains nonaggregated column 'mydb.t.address' which
  453. is not functionally dependent on columns in GROUP BY clause; this
  454. is incompatible with sql_mode=only_full_group_by
  455. SELECT name, ANY_VALUE(address), MAX(age) FROM t GROUP BY name;
  456. mysql> SELECT name, MAX(age) FROM t;
  457. ERROR 1140 (42000): In aggregated query without GROUP BY, expression
  458. #1 of SELECT list contains nonaggregated column 'mydb.t.name'; this
  459. is incompatible with sql_mode=only_full_group_by
  460. SELECT ANY_VALUE(name), MAX(age) FROM t;
  461. SELECT DISTINCT c1, c2 FROM t ORDER BY c3;
  462. SELECT name, COUNT(name) FROM orders
  463. GROUP BY name
  464. HAVING COUNT(name) = 1;
  465. SELECT name, COUNT(name) AS c FROM orders
  466. GROUP BY name
  467. HAVING c = 1;
  468. SELECT id, FLOOR(value/100)
  469. FROM tbl_name
  470. GROUP BY id, FLOOR(value/100);
  471. SELECT id, FLOOR(value/100) AS val
  472. FROM tbl_name
  473. GROUP BY id, val;
  474. SELECT id, F, id+F
  475. FROM
  476. (SELECT id, FLOOR(value/100) AS F
  477. FROM tbl_name
  478. GROUP BY id, FLOOR(value/100)) AS dt;
  479. SELECT co.Name, COUNT(*)
  480. FROM countrylanguage cl, country co
  481. WHERE cl.CountryCode = co.Code
  482. GROUP BY co.Code;
  483. SELECT co.Name, cl.Language,
  484. cl.Percentage * co.Population / 100.0 AS SpokenBy
  485. FROM countrylanguage cl, country co
  486. WHERE cl.CountryCode = co.Code
  487. GROUP BY cl.CountryCode, cl.Language;
  488. SELECT co.Name, cl.Language,
  489. cl.Percentage * co.Population/100.0 AS SpokenBy
  490. FROM countrylanguage cl INNER JOIN country co
  491. ON cl.CountryCode = co.Code
  492. GROUP BY cl.CountryCode, cl.Language;
  493. SELECT co.Name, cl.Language,
  494. cl.Percentage * co.Population/100.0 AS SpokenBy
  495. FROM countrylanguage cl LEFT JOIN country co
  496. ON cl.CountryCode = co.Code
  497. GROUP BY cl.CountryCode, cl.Language;
  498. SELECT co.Name, cl.Language,
  499. cl.Percentage * co.Population/100.0 AS SpokenBy
  500. FROM country co LEFT JOIN countrylanguage cl
  501. ON cl.CountryCode = co.Code
  502. GROUP BY cl.CountryCode, cl.Language;
  503. CREATE VIEW country2 AS
  504. SELECT co.Code, UPPER(co.Name) AS UpperName,
  505. COUNT(cl.Language) AS OfficialLanguages
  506. FROM country AS co JOIN countrylanguage AS cl
  507. ON cl.CountryCode = co.Code
  508. WHERE cl.isOfficial = 'T'
  509. GROUP BY co.Code;
  510. SELECT co2.Code, co2.UpperName, co2.OfficialLanguages,
  511. COUNT(*) AS Cities
  512. FROM country2 AS co2 JOIN city ci
  513. ON ci.CountryCode = co2.Code
  514. GROUP BY co2.Code;
  515. SELECT co2.Code, co2.UpperName, co2.OfficialLanguages,
  516. COUNT(*) AS Cities
  517. FROM
  518. (
  519. SELECT co.Code, UPPER(co.Name) AS UpperName,
  520. COUNT(cl.Language) AS OfficialLanguages
  521. FROM country AS co JOIN countrylanguage AS cl
  522. ON cl.CountryCode=co.Code
  523. WHERE cl.isOfficial='T'
  524. GROUP BY co.Code
  525. ) AS co2
  526. JOIN city ci ON ci.CountryCode = co2.Code
  527. GROUP BY co2.Code;
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/345146
推荐阅读
相关标签
  

闽ICP备14008679号