Hi Igor,
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?

Regards
Wojciech W.

I have a table with a following data:
Id    Text1   Text2   Text3   Text4
-----------------------------------
1    1001     11     test03   test13
2    1002     11     test01   test11
3    1003     12     test04   test12
4    1004     12     test02   test34
5    1004     12    test06   test56
6    1005     11    test17   test67
7    1005     12    test07   test57
8    1006     13     test05   test98
9    1007     13     test02   test93
10   1008     14     test01   test03
...  ....     ...    ......   ......
Now, I would like to select only the rows when Text2 change. So the
result of such query should look like:
Id    Text1   Text2   Text3   Text4
-----------------------------------
1    1001     11      test03   test13
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
...  ....     ...    ......   ......
How should this query look like?

select * from tableName t1
where t1.Text2 != (
   select t2.Text2 from tableName t2
   where t2.Id < t1.Id
   order by t2.Id desc limit 1);
--
Używam klienta poczty Opera Mail: http://www.opera.com/mail/

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

Reply via email to