Hello!
I have an query that shows the following
- What time did picking start and finished for an order in a specific area, in this case (fmha) Area1
I would like to add the same select for the same order one more time in the same query, but then from another area, for example Area 2
How is this best achieved? I have tried union, but didnt succed to get it correct
This is how it looks now
But I want it to be like this
this is the current query
SELECT ocarrno,
oppdate,
Min(datreg) '_Start_Picking_Area1',
Max(datreg) '_End_picking:Area1',
Cast(Max(datreg) - Min(datreg) AS TIME) '_Tidsskillnad',
fmha
FROM astro_view_cnt_svl16001
WHERE datreg < Dateadd(d, Datediff(d, 0, Getdate()), 1)
AND datreg > Dateadd(d, Datediff(d, 0, Getdate()), -1)
AND l16lcode = 4
AND fmha = 'AREA1'
GROUP BY oppdate,
ocarrno,
fmha
ORDER BY Max(datreg) DESC