Created
February 9, 2024 18:49
-
-
Save cesarockstar1985/578eed4464bae56aa930460e4954938b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
ilor.portal_id, | |
ilor.load_result, | |
ilor.type_load, | |
ilor.gross_weight, | |
ilor.document_number, | |
ilor.producer_name, | |
ilor.producer_fiscal_number, | |
point_of_delivery_plant_name, | |
ilor.point_of_delivery_fiscal_number, | |
ilor.romanian_hours, | |
ilor.romanian_date, | |
ipod.dtt_enabled, | |
case | |
when ilor.with_accompaniment = 'true' then 'Con Acompañamiento' | |
ELSE 'Sin Acompañamiento' | |
end as with_accompaniment1 | |
FROM | |
impl_load_record ilor | |
left join impl_point_of_delivery ipod on ilor.point_of_delivery_id = ipod.pod_id | |
where | |
upper( | |
point_of_delivery_fiscal_number || ' ' || point_of_delivery_plant_name || ' ' || coalesce(producer_name, '') || ' ' || coalesce(producer_fiscal_number, '') || ' ' || document_number || ' ' || load_result || ' ' || coalesce(gross_weight, '') || '' || type_load | |
) like "%%" | |
and ifnull(ilor.cast_draft_status, '') not like '0' | |
and ifnull(ilor.is_edited_new, 'false') not like 'true' | |
and ilor.portal_id != "2438511316|595975773798|1707422540159|1896026018" | |
and document_status in ('INFORMED') | |
AND point_of_delivery_id in ( | |
select | |
portal_id | |
from | |
subject | |
where | |
impl_main_point_of_delivery = "monsanto|1580245684478|2096490775|190" | |
union | |
select | |
portal_id | |
from | |
subject | |
where | |
portal_id = "monsanto|1580245684478|2096490775|190" | |
union | |
select | |
portal_id | |
from | |
subject | |
where | |
portal_id = ( | |
select | |
impl_main_point_of_delivery | |
from | |
subject | |
where | |
portal_id = "monsanto|1580245684478|2096490775|190" | |
) | |
) | |
order by | |
creation_date desc | |
limit | |
100 | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment