Doris与mysql语法对照,差异篇
## SQL语法差异:
### doris中不⽀持分组列再使⽤distinct
MSYQL:
```SQL
select DISTINCT mid from order_card_detail GROUP BY mid
```
DORIS:
```SQL
select mid from order_card_detail GROUP BY mid
```
doris执⾏异常:[Err] 1064 - errCode = 2, detailMessage = cannot combine SELECT DISTINCT with aggregate functions or GROUP BY
### mysql中 where后可直接 locate() 判断,doris中需判断
MYSQL:
```sql
select mid from order_card_detail where LOCATE(mid,'4')
```
DORIS:
```SQL
select mid from order_card_detail where LOCATE(mid,'4')>0
```
doris执⾏异常:[Err] 1064 - errCode = 2, detailMessage = WHERE clause requires return type 'BOOLEAN'. Actual type is 'INT'.
### doris 中编写sql不⽀持 #注释
MYSQL:
```SQL
#1233
select * from bers_points_detail limit 100
```
DORIS:
```sql
--1233
select * from bers_points_detail limit 100
doris
```
doris执⾏异常:[Err] 1064 - errCode = 2, detailMessage = Please check your sql, we meet an error when parsing.
### mysql中⽀持部分多表联查分组后跟部分字段,doris需将⾮聚合查询字段都放在分组条件后
MYSQL:
```SQL
SELECT m_id,behavior,SUM(point)
FROM (
select m_id,behavior,point from bers_points_detail limit 100
) t1
GROUP BY m_id;
```
DORIS:
```sql
SELECT m_id,behavior,SUM(point)
FROM (
select m_id,behavior,point from bers_points_detail limit 100
) t1
GROUP BY m_id,behavior;
```
doris执⾏异常:[Err] 1064 - errCode = 2, detailMessage = select list expression not produced by aggregation output (missing from GROUP BY clause?): `behavior`

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。