1. Jonathan Ashwell
  2. Valentina Database ADK
  3. Montag, März 13 2017, 08:03 PM
  4.  Abonnieren via E-Mail
I'm not getting the correct results when I do this search on two TEXT fields (keywords and notes).

keywords REGEX ‘ocean solutions’ AND NOT (notes REGEX ‘ocean solutions vu’)

What am I doing wrong?
Kommentar
There are no comments made yet.
Ruslan Zasukhin Akzeptierte Antwort
Hi Jon,

I think you describe not enough to understand what is wrong and what is expected
Kommentar
There are no comments made yet.
Jonathan Ashwell Akzeptierte Antwort
Hi Ruslan,

I have sample database with 4 entries. There are two indexed TEXT fields I want to a Regex search on. All 4 records have the term "ocean solutions" in the keywords field (and my app finds them if I just do a regex search for them). 2 of the records also have the term "ocean solutions vu" in the notes field. So in the search above I expect to find two records (of the 4). Instead I get 0 hits.

I get the same (incorrect) result in VStudio.
Kommentar
There are no comments made yet.
Ivan Smahin Akzeptierte Antwort
I'm trying to reproduce it but cant. It works as expected for me.
Probably it is syntax issue because string literals must be wrapped by '' (apostrophes ) - not `` (grave accents).

Please, check it twice and send me your db and exact query to check on my side if it doesn't work.
Kommentar
There are no comments made yet.
Ivan Smahin Akzeptierte Antwort
So, original query is:


SELECT * FROM thereferences WHERE keywords REGEX 'ocean solutions' AND NOT (notes REGEX 'ocean solutions vu')


Pay attention that notes are set to null for first two records. You should check it as well. Because almost any operation against NULL produces NULL - neither TRUE nor FALSE.


SELECT * FROM thereferences
WHERE
keywords REGEX 'ocean solutions' AND
( notes is null OR NOT (notes REGEX 'ocean solutions vu') )
Kommentar
There are no comments made yet.
Jonathan Ashwell Akzeptierte Antwort
Thank you, Ivan.
Kommentar
There are no comments made yet.
  • Seite :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories