
Limit
Publicado por anonymous (1 intervención) el 26/11/2021 15:21:48
Buenas, estoy teniendo problemas para que la consulta me devuelva solamente un campo del ID.
Probe con Distinct y Limit pero en ambos casos me tira un error.
SELECT
a1.shp_shipment_id,
a1.shp_status_id,
a1.shp_substatus_id,
a1.shp_date_created_id,
a2.shp_label_carrier_name,
a1.shp_order_cost,
a1.shp_picking_type_id,
a3.shp_checkpoint_date,
a3.shp_origin
from
WHOWNER.BT_SHP_SHIPMENTS a1
left join WHOWNER.BT_TMS_TRACKING a2 on a2.shp_shipment_id=a1.shp_shipment_id
left join WHOWNER.BT_SHP_ELASTICSEARCH_CHECKPOINTS a3 on a3.shp_id=a1.shp_shipment_id
where
a3.shp_checkpoint_date = (Select Max(a3.shp_checkpoint_date))
and
a1.shp_shipment_id in (40992032799)
group by 1,2,3,4,5,6,7,8,9
Probe con Distinct y Limit pero en ambos casos me tira un error.
SELECT
a1.shp_shipment_id,
a1.shp_status_id,
a1.shp_substatus_id,
a1.shp_date_created_id,
a2.shp_label_carrier_name,
a1.shp_order_cost,
a1.shp_picking_type_id,
a3.shp_checkpoint_date,
a3.shp_origin
from
WHOWNER.BT_SHP_SHIPMENTS a1
left join WHOWNER.BT_TMS_TRACKING a2 on a2.shp_shipment_id=a1.shp_shipment_id
left join WHOWNER.BT_SHP_ELASTICSEARCH_CHECKPOINTS a3 on a3.shp_id=a1.shp_shipment_id
where
a3.shp_checkpoint_date = (Select Max(a3.shp_checkpoint_date))
and
a1.shp_shipment_id in (40992032799)
group by 1,2,3,4,5,6,7,8,9
Valora esta pregunta


0