小编pat*_*m83的帖子

SQL与Oracle中的group by区别开来

我有以下SQL:

select 
  origin,destination,to_char(to_date(substr(ship_date,1,6),'YYMMDD'),
  'YYYY-MM-DD'),ship_date,trip_number, distinct ship_number  
from shipment a 
where 
  a.scc_code in ('xxxxx','xxxxx','xxxxx') 
  and load_status = 'S' and ship_date like '11%' 
  and shipper_id = XXXXXX
group by origin,destination,ship_date,trip_number, ship_number
Run Code Online (Sandbox Code Playgroud)

当我在Oracle中运行此SQL时,它给出了ORA-00936:缺少表达式.如果我删除distinct关键字,它运行正常.谁能告诉我这两件事之间的区别?

sql oracle group-by distinct

6
推荐指数
1
解决办法
3万
查看次数

标签 统计

distinct ×1

group-by ×1

oracle ×1

sql ×1