I have always used the group by to get the last physical record in the table and have found that the results have been always been what I expected. I would like to convert my code to play by the VFP8 rules. Does anyone have a good way to get to the same result using proper SQL?
I have a table with attendees and information about the seminar they attended.
Select * from sem order by sem_time desc into cursor sem
Select attd_id, sem_time, sem_loc, sem_cost ;
from sem ;
group by attd_id ;
into cursor sem2
This gives me the information about the last or first seminar of each attendee depending on the order I specify in the first statement.
I would like to continue using only SQL statements, is there a simple solution given the new constraints on Group by?
>
>Pedro,
>In previous version of VFP, if you did not specify a field in the Group By clause, VFP would use the value associated with the record that occured last physically in the table. If you sorted the same table or packed it, you could end up with the same query returning two different results. This was considered to be a bug and was corrected in VFP 8.
>
>If you don't care what values wind up in the extra columns, then don't include them in the query. This will decrease the number of fields you need to add in the Group By clause.
>
>Regards.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement