Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unexpected query result
Message
From
12/03/2001 09:12:57
 
 
To
12/03/2001 08:35:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00483532
Message ID:
00484011
Views:
30
>>The problem shows itself with such a trivial example, I really can't bring myself to believe that it is a fault with the SQL in VfP - it must be something I'm missing, but I just can't see what.
>
>Len - maybe this was in the original message, but can you write code that includes CREATE TABLE statements and INSERT INTO so that we can paste the whole thing into a program and play with it.
>
>Thanks,
>Tamar

As requested, with a few examples - in each case I believe the goodtbl{n} and badtbl{n} should give the same results.In all cases, the goodtbl{n} results are what I expect. In the case of badtbl2 & badtbl3, I think the results should be identical.
set safety off
create table tbla (fld1a C(10), fld2a N(5,0))
insert into tbla values ("ABCD", 1)
insert into tbla values ("ABC", 2)
use
create table tblb (fld1b C(10), fld2b N(5,0))
insert into tblb values ("ABC", 1)
insert into tblb values ("ABC", 2)
use

select * from tbla, tblb into cursor tblc

select * from tblc where (trim(fld1a)=trim(fld1b)) into cursor goodtbl1
select * from tbla, tblb where (trim(fld1a)=trim(fld1b)) into cursor badtbl1

select * from tblc where (fld2a=2) AND (trim(fld1a)=trim(fld1b)) AND (fld2a=fld2b) into cursor goodtbl2
select * from tbla, tblb where (fld2a=2) AND (trim(fld1a)=trim(fld1b)) AND (fld2a=fld2b) into cursor badtbl2

select * from tblc where (fld2a=fld2b) AND (trim(fld1a)=trim(fld1b)) AND (fld2a=2) into cursor goodtbl3
select * from tbla, tblb where (fld2a=fld2b) AND (trim(fld1a)=trim(fld1b)) AND (fld2a=2) into cursor badtbl3

select * from tblc where (fld2a=fld2b) AND (trim(fld1a)=trim(fld1b)) AND (fld2a=fld2b) into cursor goodtbl4
select * from tbla, tblb where (fld2a=fld2b) AND (trim(fld1a)=trim(fld1b)) AND (fld2a=fld2b) into cursor badtbl4

select * from tblc where (fld2a=fld2b) AND (trim(fld1a)=trim(fld1b)) into cursor goodtbl5
select * from tbla, tblb where (fld2a=fld2b) AND (trim(fld1a)=trim(fld1b)) into cursor badtbl5
Len Speed
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform