The most likely problem is the field type you are checking. Using your syntax on a text field I get the correct results. If I use a date field the results are empty because the date is stored in a different format than may be displayed. The internally stored format is YYYY-MM-DD
even though you may see Tuesday, July 15, 2014
because of format selected.
Edit:
Attached is sample with a simple table with two Queries. Query1 is using the Text
field in the table and Query2 is using the Date
field in the same table.
Sample: DateQuery.odb
Just for information - Base
is not a DB but a front end to a DB. If not modified you are using HSQL. You could have been using others such as MySQL or PostgreSQL or others.
You may need to change you statement to :
SELECT CASE WHEN LENGTH("Tdate") = 20 THEN SUBSTRING("Tdate",1,8) WHEN LENGTH("Tdate") = 21 THEN SUBSTRING("Tdate",1,9) WHEN LENGTH("Tdate") = 22 THEN SUBSTRING("Tdate",1,10) END AS "Sales_Date" FROM "Sales"
Second Edit:
Loaded small sample of data (179 records of the 500K plus) and used your exact SQL. Here are the results:
All fields were set as Text except Price - set as Number. “strap” field was set as KEY
field. All records produced a result.
The only difference on my system is the LO version (5.1.3.2) and OS - Linux xubuntu v16.04. On RARE occasion, there has been a problem in the Windows version. It would be more likely be because of the LO version.
Sample2: SalesCSV.odb