Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Linked server
Message
From
10/09/2008 16:44:35
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Linked server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01346475
Message ID:
01346475
Views:
61
I have the following VFP code:
SELECT m.ccompno, AVG(i.ncost) ;
FROM ICIWHS i inner join MIBOML m ;
on i.citemno + cwarehouse = m.ccompno ;
where m.citemno = '02006' ;
GROUP BY m.ccompno ;
ORDER BY m.ccompno

Table ICIWHS has an index on citemno + cwarehouse, MIBOML is endexed on citemno
Code works as expected.

On SQL side I have this:
select * from openquery(VAMCPD, 'SELECT m.ccompno, AVG(i.ncost) FROM ICIWHS i inner join MIBOML m
on i.citemno + cwarehouse = m.ccompno
where m.citemno = ''02006'' group by m.ccompno')

That returns no records ????

What I have found is that it only works if comnad looks something like this:

select * from openquery(VAMCPD, 'SELECT * FROM ICIWHS
where citemno + cwarehouse like ''02006''')

Works very fast.

This will work too:
select * from openquery(VAMCPD, 'SELECT m.ccompno, AVG(i.ncost) FROM ICIWHS i inner join MIBOML m
on i.citemno = m.ccompno
where m.citemno = ''02006'' group by m.ccompno')
but will take foreever.

What I am saying is it really likes LIKE when it comes to use indexes.

Any idea why:
select * from openquery(VAMCPD, 'SELECT m.ccompno, AVG(i.ncost) FROM ICIWHS i inner join MIBOML m
on i.citemno + cwarehouse = m.ccompno
where m.citemno = ''02006'' group by m.ccompno')
does not work?

Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform