SQL Error

Author: Gene Wirchenko

Posted: 2017-08-07 at 19:35:41

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

_______________________________________________

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/e1e0a69d16c392845064f933af190212@mtlp000083

** 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.

©2017 Gene Wirchenko