Please help me with this stored procedure. Thank you.

Please help me with this stored procedure. Thank you.

Post by Sandra Cliffor » Sun, 24 Sep 2000 04:00:00



Hi,
I have a problem writing a stored procedure. Can you help me write a stored
procedure.  Please look at this link for a detailed description of my
problem.

http://members.home.net/wgromczynski/SandraClifford/Puzzle3.htm

Thank you so much.

 
 
 

Please help me with this stored procedure. Thank you.

Post by Allan Mitchel » Sun, 24 Sep 2000 04:00:00


does table 1 join to table 2 on code1 = code2?

If so does this do it

SELECT
t1.sid,
t1.names,
count(t2.code2)
from
table1 t1 join table2 t2 on
t1.code1=t2.code2 join
table3 t3 on t2.rid = t3.rid
where


group by
t1.sid,
t1.names

Allan



Quote:> Hi,
> I have a problem writing a stored procedure. Can you help me write a
stored
> procedure.  Please look at this link for a detailed description of my
> problem.

> http://members.home.net/wgromczynski/SandraClifford/Puzzle3.htm

> Thank you so much.

--

Allan Mitchell
MCSE

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Please help me with this stored procedure. Thank you.

Post by oj » Sun, 24 Sep 2000 04:00:00


Try...

if object_id('CntProc') is not null
 drop proc CntProc
go
create procedure CntProc


as
select
 SID=t1.sid,
 NAME=t1.names,
 COUNTS=count(*)
from
 table1 t1 join (table2 t2 join table3 t3 on t3.rid=t2.rid) on
t1.code1=t2.code2
where


group by
 t1.sid,
 t1.names
go

HTH.

-oj


Quote:> Hi,
> I have a problem writing a stored procedure. Can you help me write a
stored
> procedure.  Please look at this link for a detailed description of my
> problem.

> http://members.home.net/wgromczynski/SandraClifford/Puzzle3.htm

> Thank you so much.

 
 
 

Please help me with this stored procedure. Thank you.

Post by Sandra Cliffor » Mon, 25 Sep 2000 10:28:33


Thank you Allan. It worked well.

> does table 1 join to table 2 on code1 = code2?

> If so does this do it

> SELECT
> t1.sid,
> t1.names,
> count(t2.code2)
> from
> table1 t1 join table2 t2 on
> t1.code1=t2.code2 join
> table3 t3 on t2.rid = t3.rid
> where


> group by
> t1.sid,
> t1.names

> Allan



> > Hi,
> > I have a problem writing a stored procedure. Can you help me write a
> stored
> > procedure.  Please look at this link for a detailed description of my
> > problem.

> > http://members.home.net/wgromczynski/SandraClifford/Puzzle3.htm

> > Thank you so much.

> --

> Allan Mitchell
> MCSE

> Sent via Deja.com http://www.deja.com/
> Before you buy.

 
 
 

Please help me with this stored procedure. Thank you.

Post by Sandra Cliffor » Mon, 25 Sep 2000 10:30:50


Thank you oj ,   I have another problem with a trigger, If you help me I
will be very grateful. Here is a link to the description:

http://members.home.net/wgromczynski/SandraClifford/puzzle4.htm

Thank you.


> Try...

> if object_id('CntProc') is not null
>  drop proc CntProc
> go
> create procedure CntProc


> as
> select
>  SID=t1.sid,
>  NAME=t1.names,
>  COUNTS=count(*)
> from
>  table1 t1 join (table2 t2 join table3 t3 on t3.rid=t2.rid) on
> t1.code1=t2.code2
> where


> group by
>  t1.sid,
>  t1.names
> go

> HTH.

> -oj



> > Hi,
> > I have a problem writing a stored procedure. Can you help me write a
> stored
> > procedure.  Please look at this link for a detailed description of my
> > problem.

> > http://members.home.net/wgromczynski/SandraClifford/Puzzle3.htm

> > Thank you so much.

 
 
 

Please help me with this stored procedure. Thank you.

Post by Allan Mitchel » Mon, 25 Sep 2000 15:31:00


Sandra
You do not say how you get your starting point ie why did you in the
example chhose 6 to start off.  Also will it always be 3 iterations ie
2x3x8

Allan

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Please help me with this stored procedure. Thank you.

Post by Graha » Mon, 25 Sep 2000 04:00:00


sandra,
you just need to take the code I provided for creating the codes and convert
it to a trigger e.g.

Create TRIGGER Puzzle_Insert ON Puzzle for INSERT
AS








BEGIN


 BEGIN



  BEGIN

  END
  ELSE
  BEGIN

  END
 END





END


> Thank you oj ,   I have another problem with a trigger, If you help me I
> will be very grateful. Here is a link to the description:

> http://members.home.net/wgromczynski/SandraClifford/puzzle4.htm

> Thank you.



> > Try...

> > if object_id('CntProc') is not null
> >  drop proc CntProc
> > go
> > create procedure CntProc


> > as
> > select
> >  SID=t1.sid,
> >  NAME=t1.names,
> >  COUNTS=count(*)
> > from
> >  table1 t1 join (table2 t2 join table3 t3 on t3.rid=t2.rid) on
> > t1.code1=t2.code2
> > where


> > group by
> >  t1.sid,
> >  t1.names
> > go

> > HTH.

> > -oj



> > > Hi,
> > > I have a problem writing a stored procedure. Can you help me write a
> > stored
> > > procedure.  Please look at this link for a detailed description of my
> > > problem.

> > > http://members.home.net/wgromczynski/SandraClifford/Puzzle3.htm

> > > Thank you so much.