当前位置:   article > 正文

阿里云odps SQL_阿里云动态sql

阿里云动态sql

odps官方网站

使用示例:

#使用TO_DATE
select *
from xx_bi.dwd_bi_wide_order_pay_record_detail_di where ds='20210711'
and payment_time  between TO_DATE('2021-07-09 00:00:00','yyyy-mm-dd hh:mi:ss') and TO_DATE('2021-07-09 23:59:59','yyyy-mm-dd hh:mi:ss')

#使用to_char
select *
from xx_bi.dwd_bi_wide_order_pay_record_detail_di where ds='20210711'
and to_char(payment_time,'yyyy-mm-dd hh:mi:ss') between '2021-07-09 00:00:00' and '2021-07-09 23:59:59'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

交集、并集、补集

--取交集不去重。
<select_statement1> intersect all <select_statement2>;
--取交集并去重。intersect效果等同于intersect distinct。
<select_statement1> intersect [distinct] <select_statement2>;

--取并集不去重。
<select_statement1> union all <select_statement2>;
--取并集并去重。
<select_statement1> union [distinct] <select_statement2>;

--取补集不去重。
<select_statement1> except all <select_statement2>;
<select_statement1> minus all <select_statement2>;
--取补集并去重。
<select_statement1> except [distinct] <select_statement2>;
<select_statement1> minus [distinct] <select_statement2>;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号