<mode>render</mode>
2,3

<mode>ascii</mode>
col_names=>Source,Destination,Congested {resolution} 
col_numbers=>2,3,4

<mode> query  </mode>
WITH 
MinuteNonLossCount(NodePairID, Time, NonLoss) as 
( 
SELECT  t.NodePairID as NodePairID, 
	((t.start/{offset}) - ({start_time}/{offset})) as Time, 
	count(*) as NonLoss 
FROM {schema_name}Times t 
WHERE 	t.Delay != -1 AND 
	t.start BETWEEN ({start_time}) AND ({end_time}) 
GROUP BY t.NodePairID, (t.start/{offset}) 
), 
MinuteProbeCount(NodePairID, Time, Probes) as 
( 
SELECT 	t.NodePairID as NodePairID, 
	((t.start/{offset}) - ({start_time}/{offset})) as Time, 
	count(*) as Probes 
FROM {schema_name}Times t 
WHERE  t.start BETWEEN ({start_time}) AND ({end_time}) 
GROUP BY t.NodePairID, (t.start/{offset}) 
)  
SELECT 	nlc.NodePairID as "Path Spec", 
	src.name as "Source",
	dest.name as "Destination",  
	nlc.Time as "Congested Minute"  
FROM MinuteNonLossCount nlc, MinuteProbeCount pc, {schema_name}Nodes src, 
{schema_name}Nodes dest, {schema_name}NodePairs np  
WHERE 	nlc.NodePairID = pc.NodePairID AND 
	nlc.NodePairID = np.id AND 
	np.srcnodeid = src.NodeID AND 
	np.destnodeid = dest.NodeID AND 
	nlc.Time = pc.Time AND 
	(pc.Probes - nlc.NonLoss) > 2 AND 
	((nlc.NonLoss*100)/pc.Probes + 1) <= 99 
GROUP BY nlc.NodePairID, src.name, dest.name, nlc.Time 
<mode>endquery</mode>
