Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex SQL Statement
Message
 
 
To
08/11/2007 09:15:39
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01267579
Message ID:
01267589
Views:
7
>I have a table with partno, status, and date fields. There are duplicate partno's but each have a different date. The status is either 1(accepted) or 2(rejected). It is my goal to find the partno's with the latest date that are at a status of 1. Management needs to know the percentage of partno's not cleared through First Article Inspection(status).

Try (not tested)
SELECT mt1.* 
	FROM mytable mt1	
		JOIN ( SELECT partno, MAX(date) AS MaxDate FROM mytable GROUP BY partno ) mt3
			ON mt3.partno = mt1.partno AND mt3.MaxDate = mt1.date
	WHERE mt1.status = 1	
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform