Reply to Re: help with while loops

Your name:

Reply:


Posted by Erland Sommarskog on 08/23/07 21:56

(lhiregoudar@hotmail.com) writes:
> hi,
> I am trying to
> 1)get all the names of a table that match another table
> 2)while count=0, then I want to insert into another table 'group'
> after getting its key.
>
> I am totally lost, can somebody point me in the right direction.
>
> how do I get the individual name so that I can insert into the group
> table,
> I tried 'select @name=name, that gave no results'.
> Thanks
>
> while (SELECT name FROM names WHERE name in (select name from Group)
> and status = 'M' )=0
> begin
> insert into CAll(group_id,name,action) values (@key, name, 'play' )
> end
>
> how do i get the individual names to insert into another table ..

You are the only one who is lost. I am also lost in trying to understand
what you want to achieve. A standard recommendation is that you post:

o CREATE TABLE statements for your tables.
o INSERT statements with sample data.
o The desired result given the sample.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация