Subject Re: Query error
From Tom <IHaveNoEmail@ddress>
Date Sat, 2 Sep 2023 07:00:20 -0400
Newsgroups dbase.getting-started

On 9/2/23 3:55 AM, Mervyn Bick wrote:
> On 2023/09/01 19:10, Tom wrote:
>> Hi all,
>>
>> Having trouble with the following query which produces a 'type
>> mismatch in expression' error. I thought I ave the TestDate timkeStamp
>> field converted to a character field so I could search of a value with
>> the 'like' expression. dBase is not happy with my efforts. Can you
>> correct the error? Mind the wrap.
> ....
>>  sql = [Select CAST(TestDate as Char(10)) d.TestDate, d.Provider,
>> d.Client, ;
>
>                   CAST(d.TestDate as char(10)) cTest_date
>
>>        d.Category, d.Allergen, d.TestLevel, d.StdTestRange,
>> n.Demodata_Notes ;
>>        FROM DemoData d Left Join DemoNotes n On n.Fk_DemoData =
>> d.Pk_DemoData        WHERE ;
>>        d.TestDate LIKE :TestDate AND ;
>
>            cTestDate LIKE :TestDate ....
>
>>        LOWER(d.Category) LIKE :Category AND ;
>>        LOWER(d.Allergen) LIKE:Allergen ;
>>        ORDER BY TestDate, Category, Allergen ]
>
> I'm running out of time as the power is due to go off for 2 hours in 7
> minutes.
>
> I'll add more later.
>
> Mervyn.
>
>
>
Revision:

sql = "Select CAST(TestDate as Char(10)) cTestDate, d.TestDate,
d.Provider, d.Client, d.Category, d.Allergen, d.TestLevel,
d.StdTestRange, n.Demodata_Notes FROM DemoData d Left Join DemoNotes n
On n.Fk_DemoData = d.Pk_DemoData WHERE cTestDate LIKE :TestDate AND
LOWER(d.Category) LIKE :Category AND LOWER(d.Allergen) LIKE :Allergen
ORDER BY TestDate, Category, Allergen"

gets me an 'Invalid Field Name' error message. :(

Tom