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 |
saidev
Posting Yak Master
101 Posts |
Posted - 2006-07-24 : 17:11:12
|
Guys,I have a query from a table name called "tblspot", SELECT DISTINCT fkGroup, fkAgency, fkAdvertiser FROM tblSpotwhat i want is i want to insert this 'fkagency' and 'fkadvertiser' into another table called "tblinvoice" which already has fields with "fkagency" and "fkadvertiser"Can you guys help me with the queryThanks, |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-24 : 17:13:59
|
INSERT INTO tblinvoice(fkGroup, fkAgency, fkAdvertiser)SELECT DISTINCT fkGroup, fkAgency, fkAdvertiser FROM tblSpotTara Kizer |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-07-24 : 22:47:00
|
insert into tblInvoice(fkagency,fkadvertiser,...)select fkagency,fkadvertiserfrom (select distinct fkgroup,fkagency,fkadvertiser from tblspot) aor do you wish to check for existence of those field values first and prevent duplicate rows?--------------------keeping it simple... |
|
|
|
|
|
|
|