Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT SQL question
Message
De
26/03/2004 09:37:31
 
 
À
26/03/2004 09:33:38
Steven Kleypas
Tarrant County College District
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00889939
Message ID:
00889942
Vues:
21
>What is the correct syntax to do something like the following?
>
>FUNCTION GetStudentCount
>LPARAMETERS tnCourseID
>RETURN SELECT COUNT(*) FROM v_students WHERE iCourseID = tnCourseID

Here's one way
FUNCTION GetStudentCount
LPARAMETERS tnCourseID
SELECT * FROM v_students WHERE iCourseID = tnCourseID TO SCREEN NOCONSOLE
RETURN (_TALLY)
Or there is a COUNT command
FUNCTION GetStudentCount
LPARAMETERS tnCourseID
LOCAL ln_count
SELECT v_students 
COUNT TO ln_count FOR iCourseID = tnCourseID 
RETURN (ln_count)
The last one will move the record pointer to the EOF on v_students.
Charles

"The code knows no master." - Chuck Mautz
"Everybody is ignorant, only on different subjects." - Will Rogers
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform