Printer FriendlyEmail Article Link

How do you concantenate strings in SQLite?

Answer

The "||" is the concatenation operator.  Here's an example where we take the 16 bit filters over an IP address from "Filtered Stream Results" to form an IP address.

Comp16_3 = 12850 (0x3232)
Comp16_4 = 12805 (0x3205)

(Comp16_3/256) || "." || (Comp16_3 % 256) || "." || (Comp16_4/256) || "." || (Comp16_4 % 256)  yields "50.50.50.5"

Example in SQL Query:
select (Comp16_3/256) || "." || (Comp16_3 % 256) || "." || (Comp16_4/256) || "." || (Comp16_4 % 256) as ipaddr, Comp16_3, Comp16_4, * from ( select PortName as 'Rx Port Name', Comp32, Comp16_1, Comp16_2, Comp16_3, Comp16_4, StreamIndex as 'Stream Index', FrameCount as 'Rx Count (Frames)', SeqRunLength as 'Sequence Run Length', DroppedFrameCount as 'Dropped Frame Count(per stream)', (case when (coalesce((SigFrameCount + DroppedFrameCount - DuplicateFrameCount), 0)) <= 0 then '0' else round(cast((DroppedFrameCount * 100.0 / coalesce((SigFrameCount + DroppedFrameCount - DuplicateFrameCount), 0)) as double), 5) end) as 'Dropped Frame Percent(per stream)', InOrderFrameCount as 'In-order Count (Frames)', ReorderedFrameCount as 'Reordered Frame Count', DuplicateFrameCount as 'Duplicate Frame Count', LateFrameCount as 'Late Frame Count' from RxEotStreamResults where DataSetId = 1 order by DataSetId, ParentHnd ) where ("Dropped Frame Count(per stream)" > 0.0)


Product : Windows GUI