woj <[EMAIL PROTECTED]> wrote:
Thanks for your reply, the query you have suggested works fine, but
there is missing the first row, so the result look:

Id    Text1   Text2   Text3   Text4
 -----------------------------------
 3    1003     12      test04   test12
 6    1005     11     test17   test67
 7    1005     12      test07   test57
 8    1006     13      test05   test98
 10   1008     14      test01   test03
 ...  ....     ...    ......   ......

but of course there is an EXACT answer for my question - there are
selected only the rows when Text2 changes... How to get also always
the first row from original data set?

select * from tableName t1
where coalesce(
t1.Text2 != (select t2.Text2 from tableName t2
        where t2.Id < t1.Id
        order by t2.Id desc limit 1),
   1);

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to