VFP6: Query Problem - 03-22-2005 , 01:04 PM
What is wrong with
select left(workdesc,50) as wd,* from cwkt;
where left(funccode,1)="$" and "P#"$wd order by wd
where workdesc is a memo?
I do not get an error message, but I also get no rows returned.
I expected plenty, and the rows are there. If I replace the second
What is the difference in meaning between the two statements?
("P#" will normally be at the beginning of the memo.)
Re: VFP6: Query Problem - 03-22-2005 , 01:41 PM
On Tue, 22 Mar 2005 11:04:02 -0800, Gene Wirchenko
<genew (AT) ucantrade (DOT) com.NOTHERE> wrote:
"AS wd" clause of SELECT command has not been processed yet when command
is interpreted, so your WHERE condition referring to wd should always
returns false. I am surprised that it doesn't barf on "ORDER BY wd" -
it should be "ORDER BY 1" to work. Must be version-specific.
[ When replying, remove *'s from address ]
Alexandre Peshansky, Systems Manager, RUH, NY
Re: Query Problem - 03-22-2005 , 02:03 PM
"wd" is not yet known by the WHERE condition parser. It doesn't become
known until the records are retrieved and needed for the ORDER BY. At
least, that's my SWAG on how it works, I have no inside actual knowledge of
the way the VFP SQL parser works.
Microsoft Visual FoxPro MVP
"Gene Wirchenko" <genew (AT) ucantrade (DOT) com.NOTHERE> wrote
Re: Query Problem - 03-22-2005 , 02:43 PM
Also, PADR(workdesc, 50) would be better than LEFT(workdesc, 50), because
you might run into a short workdesc some day, and your resulting field will
then be smaller than you expect.
"Fred Taylor" <ftaylor (AT) mvps (DOT) org!REMOVE> wrote