How many new tickets per queue / day

How many new tickets per queue / day

Hi!
i have 4 lines like this,    First-line,  Second-line , Second-Planned-Line, Third-line

All tickets sent by mail are created in firstline and then moved to other lines after that, and tickets by phone can be created in the other lines directly.

And i want to know how many new tickets every line got this day.

And that means that they can have been created yesterday, but moved to a new line today, so new for the line but not by createdtime stamp.

So i want to now alla new och moved tickets on every line.

Today i use this sql but something is not beeing right.

SELECT wo.WORKORDERID
FROM WorkOrder wo
LEFT JOIN WorkOrder_Queue woq ON wo.WORKORDERID=woq.WORKORDERID 
LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID 
WHERE  
((qd.QUEUENAME COLLATE SQL_Latin1_General_CP1_CI_AS = N'1:a Linje')  
 AND 
(((wo.CREATEDTIME >= ".$timestamp.") AND 
((wo.CREATEDTIME != 0) AND 
(wo.CREATEDTIME IS NOT NULL))) AND 
((wo.CREATEDTIME <= ".$timestamp2.") AND 
(((wo.CREATEDTIME != 0) AND 
(wo.CREATEDTIME IS NOT NULL)) AND 
(wo.CREATEDTIME != -1)))))  AND 
wo.ISPARENT='1'
UNION
SELECT wo.WORKORDERID from [Servicedesk].[dbo].[WorkOrder] wo
LEFT JOIN [Servicedesk].[dbo].[WorkOrderHistory] woh ON wo.WORKORDERID = woh.WORKORDERID
LEFT JOIN [Servicedesk].[dbo].[WorkOrderHistoryDiff] wohd ON woh.HISTORYID = wohd.HISTORYID
where 
cast(wohd.COLUMNNAME as nvarchar) in ('QUEUEID') AND  wohd.CURRENT_VALUE = '601' AND woh.OPERATIONTIME >= ".$timestamp."
ORDER BY 1

in the firstline, the number should be bigger and bigger during the day, but it goes up and down... i dont understand why.

                  New to ADSelfService Plus?