Hello,

I have a table and I need only one record from it, even if this record has a duplicate. How can this be written in SQL? thanks in advance

enter image description here

SELECT UniCode, CmpUnicode2, CmpUnicode1 FROM test_table tt JOIN yt_unicode yu ON yu.CmpUnicode1 = tt.CmpUnicode1 HAVING count (*) = 1

  • I need, for example 4 line. The problem is that I do join the data that comes with CmpUnicode1 - dron4ik
  • SELECT UniCode, CmpUnicode2, CmpUnicode1 FROM test_table tt JOIN yt_unicode yu ON yu.CmpUnicode1 = tt.CmpUnicode1 HAVING count (*) = 1 - dron4ik
  • I need in this case only one entry, for example 4 - dron4ik

2 answers 2

SELECT min(UniCode), min(CmpUnicode2), tt.CmpUnicode1 FROM test_table tt JOIN yt_unicode yu ON yu.CmpUnicode1 = tt.CmpUnicode1 group by tt.CmpUnicode1 

    You can add the condition LIMIT 3.1 where 3 means that the show will start from the 4th line, and 1 means that 1 entry will be displayed ...

     SELECT UniCode, CmpUnicode2, CmpUnicode1 FROM test_table tt JOIN yt_unicode yu ON yu.CmpUnicode1 = tt.CmpUnicode1 HAVING count(*) = 1 LIMIT 3,1;