求大佬帮忙处理一下,谢谢了:
SELECT *
from (select row_number() over(PARTITION BY pig_id order by arr_date desc) rn,
pig_id,
farm_id
from T_BOAR_PIGINFO_MOVED
where (BOR_DATE >= to_date('2010-7-19','YYYY-MM-DD')
and BOR_DATE <= to_date('2019-7-19','YYYY-MM-DD') )
and BREED_CODE ='BB'
and FARM_ID in ('530001', '100301')
and length(Dadid) > 0
and length(MaId) > 0
and sex in (0, 1)
and exists (select * from T_BREED_GROWTH a
where a.pig_id = T_BOAR_PIGINFO_MOVED.pig_id
and a.TEST_WT_END >= 85
and a.TEST_WT_END <= 130
and a.AVERAGE_BFT >= 4
and a.AVERAGE_BFT <= 30
and a.test_days_end >= 100
and a.test_days_end <= 300)
and not exists
(select 1 from TEMP_BD_DAT_HMMY x
where x.R_ANIMAL = T_BOAR_PIGINFO_MOVED.pig_id )) a where a.rn = 1
数据库转换,Oracle语句转换成MySQL语句,始终转不了row_number ()over()
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
悬赏问题
- ¥15 maple软件,用solve求反函数出现rootof,怎么办?
- ¥50 汇编语言除法溢出问题
- ¥65 C++实现删除N个数据列表共有的元素
- ¥15 Visual Studio问题
- ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
- ¥20 求一个html代码,有偿
- ¥100 关于使用MATLAB中copularnd函数的问题
- ¥20 在虚拟机的pycharm上
- ¥15 jupyterthemes 设置完毕后没有效果
- ¥15 matlab图像高斯低通滤波