Use the MATCHING clause in your CCL query to take input from one or more elements (streams, windows, or delta streams) and produce records when a prescribed pattern is found within the input data.
Pattern streams can check whether or not events (rows from the input sources matching certain criteria) occur during a specific time interval, and then send records to downstream streams if a match has occurred.
Pattern matching can be used to distill complex relationships between data into compact and easily-maintainable expressions.
CREATE OUTPUT STREAM ThreeTrades AS SELECT T1.Symbol, T1.Price Price1, T2.Price Price2, T3.Price Price3 FROM QTrades T1, QTrades T2, QTrades T3 MATCHING[5 SECONDS: T1, T2, T3] ON T1.Symbol = T2.Symbol = T3.Symbol ;
For details on the MATCHING clause, see the SAP Sybase Event Stream Processor Programmers Reference.