I think Dave is correct, sometimes adding additional parentheses fixes things, 
even though it should work as is.

      From: Dave Crozier <da...@flexipol.co.uk>
 To: ProFox Email List <profox@leafe.com> 
 Sent: Tuesday, August 8, 2017 3:46 AM
 Subject: RE: SQL Error
   
Gene,
Have you tried bracketing the statement off:

      where;
      (cwkt.clcode=ctwc.clcode) ;
    and (cwkt.wccode=ctwc.wccode) ;
    and( cwkt.trndate between ctwc.validfr and ctwc.validto);

Dave
-----Original Message-----
From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Gene Wirchenko
Sent: 08 August 2017 01:36
To: ProFox Email List <profox@leafe.com>
Subject: SQL Error

Hello:

      The following statement throws "SQL: Error correlating fields.":

    select *;
    from cwkt;
    where;
    funccode="TW" and trndate>={^2017.07.01} and;
    exists;
      (;
      select .t. from ctwc;
      where;
      cwkt.clcode=ctwc.clcode and cwkt.wccode=ctwc.wccode and;
      cwkt.trndate between ctwc.validfr and ctwc.validto;
      );
    order by clcode,wonbr,trndate

    This statement works:

    select *;
    from cwkt;
    where;
    funccode="TW" and trndate>={^2017.07.01} and;
    exists;
      (;
      select .t. from ctwc;
      where;
      cwkt.clcode=ctwc.clcode and cwkt.wccode=ctwc.wccode and;
      cwkt.trndate>=ctwc.validfr and cwkt.trndate<=ctwc.validto;
      );
    order by clcode,wonbr,trndate

      The only difference is the second line of the nested select's where 
expression.  The first uses between, and the second uses >= and <=.

      What am I missing?

Sincerely,

Gene Wirchenko


[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/2058386185.1735488.1502186581...@mail.yahoo.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to