Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Query replaces all Titles

Status
Not open for further replies.

Cosmiccradle

Technical User
Mar 24, 2003
63
0
0
NL
I've got a table with Arabic newspaper titles and to each title the branch library. All the other insert queries I've made places one new title per branch library, the bottom one overwrites all exsisting titles, instead of each branch having 10 different titles, they now all have 10X the same title. Any thoughts on what I'm doing wrong.

Thanks

INSERT INTO [Arabische Kranten] ( ID, Titel, Vertaling, Frequentie, Uitgave, Prijs, Inhoud, Internetadres, Filiaal, Code )
SELECT [Arabische Kranten].ID, [Arabische Kranten].Titel, [Arabische Kranten].Vertaling, [Arabische Kranten].Frequentie, [Arabische Kranten].Uitgave, [Arabische Kranten].Prijs, [Arabische Kranten].Inhoud, [Arabische Kranten].Internetadres, [Arabische Kranten].Filiaal, [Arabische Kranten].Code
FROM [Arabische Kranten];


 
you need a where clause

WHERE [Arabische Kranten].branch = "branch name
 
If I did that I would have to add too many names. Example
BRANCH TITLE
Betondorp title A
Betondorp title B
Betondorp title C
Spaarndam title A
Spaarndam title B
Spaarndam title C

If I want to add one title he changes A,B, and C into D. I want it to add the title once to each branch. Not under each title that is coupled to the branch.
 
Okay I've got this much which works, does anyone have a solution for the column Filiaal, which exsists of 27 branch libraries, how can I do all 27 in one go?

INSERT INTO [Arabische Kranten] ( Titel, Vertaling, Frequentie, Uitgave, Prijs, Inhoud, Internetadres, Filiaal, Code )
SELECT 'Joan' AS Titel, 'Joan' AS Vertaling, '7x per Jaar ' AS Frequentie, ' ' AS Uitgave, '150.00' AS Prijs, ' ' AS Inhoud, ' ' AS Internetadres, 'Betondorp ' AS Filiaal, ' ' AS Code;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top