sql connect sql use test0; sql select a.col1, b.col1 from sta a inner join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' order by a.col1, b.col1; if $rows != 5 then return -1 endi if $data00 != 1 then return -1 endi if $data01 != 1 then print $data01 return -1 endi if $data10 != 1 then return -1 endi if $data11 != 2 then return -1 endi if $data20 != 2 then return -1 endi if $data21 != 1 then return -1 endi if $data30 != 2 then return -1 endi if $data31 != 2 then return -1 endi if $data40 != 3 then return -1 endi if $data41 != 3 then return -1 endi sql select a.col1, b.col1 from sta a join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1; if $rows != 4 then return -1 endi if $data00 != 1 then return -1 endi if $data01 != 1 then return -1 endi if $data10 != 1 then return -1 endi if $data11 != 2 then return -1 endi if $data20 != 2 then return -1 endi if $data21 != 1 then return -1 endi if $data30 != 2 then return -1 endi if $data31 != 2 then return -1 endi sql select a.col1, b.col1 from sta a join sta b on a.ts = b.ts; if $rows != 12 then return -1 endi sql select a.col1, b.col1 from tba1 a join tba2 b on a.ts = b.ts order by a.col1, b.col1; if $rows != 2 then return -1 endi if $data00 != 1 then return -1 endi if $data01 != 2 then return -1 endi if $data10 != 4 then return -1 endi if $data11 != 5 then return -1 endi sql select a.col1, b.col1 from tba2 a join tba1 b on a.ts = b.ts order by a.col1, b.col1; if $rows != 2 then return -1 endi if $data00 != 2 then return -1 endi if $data01 != 1 then return -1 endi if $data10 != 5 then return -1 endi if $data11 != 4 then return -1 endi sql select a.ts, a.col1, b.ts,b.col1 from sta a join sta b on a.ts = b.ts and a.t1=b.t1 order by a.t1, a.ts; if $rows != 8 then return -1 endi if $data00 != @23-11-17 16:29:00.000@ then return -1 endi if $data01 != 1 then return -1 endi if $data02 != @23-11-17 16:29:00.000@ then return -1 endi if $data03 != 1 then return -1 endi if $data10 != @23-11-17 16:29:02.000@ then return -1 endi if $data11 != 3 then return -1 endi if $data12 != @23-11-17 16:29:02.000@ then return -1 endi if $data13 != 3 then return -1 endi sql select a.ts, b.ts from sta a join sta b on a.ts=b.ts order by a.ts desc; if $rows != 12 then return -1 endi if $data00 != @23-11-17 16:29:05.000@ then return -1 endi if $data01 != @23-11-17 16:29:05.000@ then return -1 endi if $data10 != @23-11-17 16:29:04.000@ then return -1 endi if $data11 != @23-11-17 16:29:04.000@ then return -1 endi sql select a.ts, b.ts from sta a join sta b on a.ts=b.ts order by b.ts desc; if $rows != 12 then return -1 endi if $data00 != @23-11-17 16:29:05.000@ then return -1 endi if $data01 != @23-11-17 16:29:05.000@ then return -1 endi if $data10 != @23-11-17 16:29:04.000@ then return -1 endi if $data11 != @23-11-17 16:29:04.000@ then return -1 endi sql select a.ts, b.ts from sta a join sta b on a.ts=b.ts order by a.ts desc, b.ts; if $rows != 12 then return -1 endi if $data00 != @23-11-17 16:29:05.000@ then return -1 endi if $data01 != @23-11-17 16:29:05.000@ then return -1 endi if $data10 != @23-11-17 16:29:04.000@ then return -1 endi if $data11 != @23-11-17 16:29:04.000@ then return -1 endi sql select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; if $rows != 6 then return -1 endi sql select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; if $rows != 144 then return -1 endi sql select a.ts, b.ts from tba1 a join sta b on a.ts = b.ts and a.t1 = b.t1; if $rows != 4 then return -1 endi sql select a.ts, b.ts from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; if $rows != 8 then return -1 endi