Imagine a table like this.
I'm using the following query:
| selectFilter
| essql query="
SELECT
case
when delivery_string like '%ups%' then 'UPS'
when delivery_string like '%dhl%' then 'DHL'
when delivery_string like '%schenker%' then 'SCHENKER'
when delivery_string like '%early%' then 'EARLY BIRD'
when delivery_string like '%best%' then 'BEST TRANSPORT'
else 'UPS'
end as freight_companies,
case
when delivery_string like '%ups%' then 1
when delivery_string like '%dhl%' then 2
when delivery_string like '%schenker%' then 3
when delivery_string like '%early%' then 4
when delivery_string like '%best%' then 5
else 1
end as order,
sum(qty_ordered) as value
FROM 'outbound-orders'
WHERE 1 = 1
GROUP BY order
ORDER BY order DESC
What I want to do now is display the top result (i.e., the first freight company in the result set) in a separate box — using the first value in the freight_companies
column.
If the table looks like this:
I want to display 'UPS' in the box.
If it looks like:
I want to display 'DHL'.
Is that possible?
I've tried adding LIMIT 1
and then:
| getCell column="freight_companies"
| render
But it didn't work.
/Jens