oracle11g - Concatenating records when id is the same in Oracle -
oracle11g - Concatenating records when id is the same in Oracle -
i have oracle 11 g database.
my table chatusers looks this:
userid - identifier seqnum - order of chat conversation chattext - chat text dateadded - datetime chat conversation happened.
an user can have multiple chat sessions in day. want combine chattext per person per day.
example:
userid seqnum dateadded chattext -------------------------------- 1 1 28-oct-14 hey, how you? 1 2 28-oct-14 have minute? 1 3 28-oct-14 wanted talk something. 1 1 25-oct-14 congratulations! 1 2 25-oct-14 on promotion
so select query homecoming results as:
userid, dateadded , completetext 1 28-oct-14 hey, how you? have minute? wanted talk something. 1 25-oct-14 congratulations! on promotion
how do this?
select userid, dateadded, listagg(chattext, ' ') within grouping (order seqnum) chatusers grouping userid, dateadded;
oracle oracle11g
Comments
Post a Comment