Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-10-01 : 09:07:12
|
| I have two tables:diary-----diarydate datetime,description varchar(25),clientno intandclients-------clientno int,statusid int,first_name varchar(25),last_name varchar(25)I want to insert a new record into the diary table for each entry of the clients table which has a statusdid of 20.How can I do this please? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-01 : 09:46:47
|
| insert into diary (columns)select columns from clients as cwhere statusid=20 and not exists(select * from diary where clientno=c.clientno)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|