2 requests are executed

select * from table where a='aaaaa' and b='bbbbb' select * from table where a like 'aaaa%' and b like 'bbbb%' 

you need to take the result of the first of the second so that the lines do not repeat in the second

Closed due to the fact that the essence of the issue is incomprehensible by the participants of Suvitruf , Darth , aleksandr barakin , Lex Hobbit , Jean-Claude 10 Nov '17 at 6:16 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • five
    it is not entirely clear what it means "the lines did not repeat." but if it is taken away, i.e. output the second query only strings suitable for like except those that would output the first query, then: where a like 'aaaa%' and b like 'bbbb%' and NOT (a='aaaaa' and b='bbbbb') - Mike
  • one
    hard to live without EXCEPT :) - teran
  • I mean that the like request should contain lines only with similar values, and all the exact matching lines would be only in the first request, like "the lines did not repeat" quite understandable, why minus? - axmed2004

1 answer 1

 SELECT * FROM table WHERE a='aaaaa' and b='bbbbb' SELECT * FROM table WHERE (a LIKE 'aaaa%' and b LIKE 'bbbb%') and NOT (a='aaaaa' and b='bbbbb')