Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPT Syntax help
Message
 
 
To
24/08/2010 17:42:23
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01478231
Message ID:
01478239
Views:
35
>I am confused. Table b is the table with status and datetime stamp.

One possibility then:
select distinct a.PartNo 
from Table a inner join TableB B1 on a.PartNo = B1.PartNo
 where B1.Status = 2 and B1.DateTime = (select max(DateTime) from Tableb b where a.PartNo = b.PartNo)
Same using EXISTS:
select a.PartNo from TableA a where a.PartNo = (select top 1 PartNo from TableB order by Date desc) and
exists (select 1 from TableB b where a.PartNo =  b.PartNo and b.Status  =2)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform