SQLTeam.com | Weblogs | Forums

How can do a loop select stmt from this folowing table

Hi..How can do a loop statement for the following table

first loop shld be e1,e2,e3....
first loop start
sub loop shld be t1,t2,t3 ....
sub loop start
select stmt
sub loop end
first loop end

drop table sample_data

go

create table sample_data

(

id varchar(20) ,

Eid varchar(20),

typ varchar(20),

dur float

)

GO

insert into sample_data (id,Eid,typ,dur) VALUES ( '1','e1','t1','18.00')

insert into sample_data (id,Eid,typ,dur) VALUES ('2','e2','t1','14.00')

insert into sample_data (id,Eid,typ,dur) VALUES ('3','e3','t2','20.00')

insert into sample_data (id,Eid,typ,dur) VALUES ('4','e4','t3','13.00')

insert into sample_data (id,Eid,typ,dur) VALUES ('5','e5','t3','15.00')


GO

SELECT * FROM sample_data

GO

hi

could you please explain a little more clearly ..

Then we can think of the SQL how to do it ?

What do you want the loops to do?