Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAX function
Message
From
10/08/2007 13:00:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/08/2007 12:35:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01247432
Message ID:
01247442
Views:
23
>Hi All:
>
>How do you retrieve the record that has the latest date from a table? I thought you use the MAX function but the following code gives me all the records from the table.
>
>Thanks,
>
>Yossi
>
>
>SELECT MAX(fp_dlvdat), fp_prccorn, fp_prcsoy ;
>	FROM feedpric ;
>	GROUP BY fp_prccorn, fp_prcsoy ;
>	INTO CURSOR result	
>
select fp_dlvdat, fp_prccorn, fp_prcsoy ;
	FROM feedpric t1 ;
  where fp_dlvdat == ;
  (SELECT MAX(fp_dlvdat);
	FROM feedpric t2 ;
	where t1.fp_prccorn == t2.fp_prccorn and t1.fp_prcsoy == t2.fp_prcsoy) ;
	INTO CURSOR result	
PS: http://www.foxyclasses.com/sql_date.htm

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform