Subject Re: SQL stop sorting at middle of table
From Mervyn Bick <invalid@invalid.invald>
Date Thu, 3 Jan 2019 16:19:52 +0200
Newsgroups dbase.getting-started

On 2019-01-03 3:49 PM, Keith wrote:

> Thx Mervyn for your help.
> Your codes generated the same result.
> I check the content of Condate and found it is stored as "dd/mm/yyyy".
> Would this affect the count?
> Much appreciation for your help and as newbies I am studying your code line by line.
> Best regards


If condate is a date field than any value will be stored internally as a
date.  The value will be displayed in what ever format has been set for
dBASE.  If you  SET DATE TO BRITISH  in a program or from the Command
Panel the date will display as dd/mm/yyyy while SET DATE TO AMERICAN
will cause the date to display as mm/dd/yyyy. See the help file for
other settings.

localSQL requires dates in a SQL SELECT statement to be literal values
in either 'mm/dd/yyyy' (American) or 'dd.mm.yyyy' (German) format no
matter what format is set for the date.

If condate is a date field the code I posted should work.  If condate is
a character field then this will explain why the code (both yours and
mine) isn't working properly.

Please check the field type for condate and let me know what it is.  If
it is a character the code needs to be adjusted.  If it is a character
field you will need to make sure you have used the same format for all
records.

Perhaps the easiest way to do this is, in the Command Panel, enter the
following.

use consults
display structure
use

While you're at it  ? set("date")  in teh Command Panel will give you
the setting for the date format in dBASE.

Mervyn.