Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT SQL question
Message
From
26/03/2004 09:37:31
 
 
To
26/03/2004 09:33:38
Steven Kleypas
Tarrant County College District
Texas, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00889939
Message ID:
00889942
Views:
19
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform