Thread: looping problem
View Single Post
Old 11-26-2004, 04:10 PM   #1 (permalink)
maria_arif
Registered User
 
Join Date: Nov 2004
Posts: 3
maria_arif is on a distinguished road
looping problem

hello to all experts there..

i got a big problem with looping here.
my problem is like this:


i have make an sql statement to count students in each class like this. i'm using VB6.0:

select class, count(*) from classes where year='1999'
order by class

and the output is like this:

classA = 10
classB = 5
classC = 0

i want to relocate students from classA to class B and C where i take 3 students from classA to

classB and 2 students from classA to classC and it become like this. the relocation is done with

the value i put in the text box:

classA = 5
classB = 8
classC = 2


and after the relocation was done, each student will get their id number based on their class and

number of students for each class where the output is like this:

classA
______

A001
A002
A003
A004
A005


classB
______

B001
B002
B003
B004
B005
B006
B007
B008

classC
______

C001
C002

how to do it? i really don't know. hope you guys could help me here and i really appreciate for

any help given. Thank you
maria_arif is offline   Reply With Quote