how are you?
I never used qualify row_number()/rank() and I have some questions.
I am trying this query in teradata:
select sit_site_id
, count(distinct shp_shipment_id)
from WHOWNER.BT_SHP_SHIPMENTS
group by sit_site_id
QUALIFY RANK() OVER (PARTITION BY sit_site_id
ORDER BY count(distinct shp_shipment_id) ) = 3
But the result is: 'No data available in table'.
I want to get the first 3 sit_site_id values with more shp_shipment_id.
Where is my error?
Thanks!
QUALIFY RANK() OVER ( ORDER BY count(distinct shp_shipment_id) ) <= 3
which returns the three highest counts. - dnoethsite_id
per everyshipment_id
? Kindly share sample data and desired output. - zarruq