Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 8.0 - Select - SQL
Message
From
23/07/2003 16:12:44
Cristian Tenea
Aquila Part Prod Com
Ploiesti, Romania
 
 
To
23/07/2003 12:44:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00811460
Message ID:
00812926
Views:
10
Hi,

I have a similar question.
I used until now a select statement to retrieve first (or last) invoice to a client with something like:
SELECT name, date, invoiceserial FROM invoices ;
GROUP BY name ;
ORDER BY name, date ASC (or DESC)
wich always gets the first value from invoiceserial within name grup.
Can't use a agregate on invoiceserial wich is not in secvential order by date and does not exist something like FIRST(invoiceserial)

Should use somenthing like:
SELECT name, MIN(date) FROM invoices GROUP BY name INTO CURSOR c1
SELECT c1.name, c1.date, invoices.invoiceserial ;
FROM c1 INNER JOIN invoices ;
ON c1.name+DTOS(c1.date)=invoices.name+DTOS(invoices.date)
but this will take twice the time for first and is not optimisable by rushmore
How it's this in SQL server?
I always get anoyed by Access in wich grup by clause is like new one in Vfp8

>Unless you really want to group by a Memo field, which doesn't seem to make a lot of sense anyway, my suggestion is just forget about it. VFP8 doesn't support Memo fields in a 'group by' clause. But even using Set EngineBehavior 70 and putting the Memo field into the 'group by' wouldn't yield anything useful anyway. Why waste the resource on it?
>
>When you select 5 fields and group on only 3 of them the information returned in the other 2 may be nothing more than the contents of the last record. There is certainly no guarantee that the information in those 2 fields will have any relationship whatever to the information in the fields that were grouped on, other than probably being the contents of at least one of the records that was looked at in creating the group, so why bother with them at all?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform