Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPT Syntax help
Message
From
24/08/2010 17:11:51
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SPT Syntax help
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:
01478231
Views:
109
Remote Database is DB2.

I have table a which is a list of part numbers.

Table b is a list of inspections performed on these part numbers. This table can have multiple records of each part number. Each record has a datetime stamp field and a status.

I need a list of part numbers from table a where the last record(greatest datetime stamp) is status 2(rejected).
Select partno From table a Where partno in (Select partno From table b Where status = 2 Order By datetime stamp Desc Fetch First 1 Rows Only)
This gives me the first record of the part number group with a status of 2. However, there is a newer record with a status of 1 so this record should not be in result set.
Next
Reply
Map
View

Click here to load this message in the networking platform