TYPE=VIEW
query=select `evthy`.`intPastureId` AS `intPastureId`,(case when (`lastcalving`.`bitIsfetus` = 1) then (to_days(`evthy`.`dateEvtDate`) - to_days(`lastevtcalv`.`dateEvtDate`)) else NULL end) AS `evtHYMRDate`,`evthy`.`intEvtId` AS `intEvtId`,`evthy`.`intCurFetal` AS `evtHYFetal`,if((`evthy`.`intCurFetal` = 1),\'头产\',\'经产\') AS `evtHYTcjc`,`evthy`.`intCowId` AS `evtCowId`,`evthy`.`dateEvtDate` AS `evtHYDate`,`heatwatch`.`hybri`.`intHyCount` AS `intHyCount` from (((`heatwatch`.`events` `evthy` join `heatwatch`.`hybri` on(((`heatwatch`.`hybri`.`intEvtId` = `evthy`.`intEvtId`) and (`heatwatch`.`hybri`.`intPastureId` = `evthy`.`intPastureId`)))) left join `heatwatch`.`events` `lastevtcalv` on(((`lastevtcalv`.`intCowId` = `evthy`.`intCowId`) and (`lastevtcalv`.`intPastureId` = `evthy`.`intPastureId`) and (`lastevtcalv`.`intClass` in (\'流产\',\'产犊\')) and (`lastevtcalv`.`dateEvtDate` < `evthy`.`dateEvtDate`)))) left join `heatwatch`.`calving` `lastcalving` on(((`lastcalving`.`intEvtId` = `lastevtcalv`.`intEvtId`) and (`lastcalving`.`intPastureId` = `lastevtcalv`.`intPastureId`))))
md5=f138a81e570a7168ccc8c0c6dfb3a450
updatable=0
algorithm=0
definer_user=roo
definer_host=%
suid=1
with_check_option=0
timestamp=2022-12-14 10:07:38
create-version=1
source=select `evthy`.`intPastureId` AS `intPastureId`,case when `lastcalving`.`bitIsfetus` = 1 then to_days(`evthy`.`dateEvtDate`) - to_days(`lastevtcalv`.`dateEvtDate`) else NULL end AS `evtHYMRDate`,`evthy`.`intEvtId` AS `intEvtId`,`evthy`.`intCurFetal` AS `evtHYFetal`,if(`evthy`.`intCurFetal` = 1,\'头产\',\'经产\') AS `evtHYTcjc`,`evthy`.`intCowId` AS `evtCowId`,`evthy`.`dateEvtDate` AS `evtHYDate`,`hybri`.`intHyCount` AS `intHyCount` from (((`events` `evthy` join `hybri` on(`hybri`.`intEvtId` = `evthy`.`intEvtId` and `hybri`.`intPastureId` = `evthy`.`intPastureId`)) left join `events` `lastevtcalv` on(`lastevtcalv`.`intCowId` = `evthy`.`intCowId` and `lastevtcalv`.`intPastureId` = `evthy`.`intPastureId` and `lastevtcalv`.`intClass` in (\'流产\',\'产犊\') and `lastevtcalv`.`dateEvtDate` < `evthy`.`dateEvtDate`)) left join `calving` `lastcalving` on(`lastcalving`.`intEvtId` = `lastevtcalv`.`intEvtId` and `lastcalving`.`intPastureId` = `lastevtcalv`.`intPastureId`))
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=select `evthy`.`intPastureId` AS `intPastureId`,(case when (`lastcalving`.`bitIsfetus` = 1) then (to_days(`evthy`.`dateEvtDate`) - to_days(`lastevtcalv`.`dateEvtDate`)) else NULL end) AS `evtHYMRDate`,`evthy`.`intEvtId` AS `intEvtId`,`evthy`.`intCurFetal` AS `evtHYFetal`,if((`evthy`.`intCurFetal` = 1),\'头产\',\'经产\') AS `evtHYTcjc`,`evthy`.`intCowId` AS `evtCowId`,`evthy`.`dateEvtDate` AS `evtHYDate`,`heatwatch`.`hybri`.`intHyCount` AS `intHyCount` from (((`heatwatch`.`events` `evthy` join `heatwatch`.`hybri` on(((`heatwatch`.`hybri`.`intEvtId` = `evthy`.`intEvtId`) and (`heatwatch`.`hybri`.`intPastureId` = `evthy`.`intPastureId`)))) left join `heatwatch`.`events` `lastevtcalv` on(((`lastevtcalv`.`intCowId` = `evthy`.`intCowId`) and (`lastevtcalv`.`intPastureId` = `evthy`.`intPastureId`) and (`lastevtcalv`.`intClass` in (\'流产\',\'产犊\')) and (`lastevtcalv`.`dateEvtDate` < `evthy`.`dateEvtDate`)))) left join `heatwatch`.`calving` `lastcalving` on(((`lastcalving`.`intEvtId` = `lastevtcalv`.`intEvtId`) and (`lastcalving`.`intPastureId` = `lastevtcalv`.`intPastureId`))))
