Hi,
I have 3 tables:
Countries:
Code, Name
Vacances:
id(autoincrement),CountryCode, NameOfCountry, numberOfdays
How to foreach country insert Row:
countryCode,'Welcome in " + nameofCountry +"!",12
Hi,
I have 3 tables:
Countries:
Code, Name
Vacances:
id(autoincrement),CountryCode, NameOfCountry, numberOfdays
How to foreach country insert Row:
countryCode,'Welcome in " + nameofCountry +"!",12
No need for a loop or "foreach"...
INSERT Vacances (CountryCode, NameOfCountry, numberOfdays)
SELECT countryCode, 'Welcome in ' + Name + '!', 12
FROM Countries
try this
insert Vacances(CountryCode, NameOfCountry, numberOfdays)
select distinct [Code],'Welcome to ' + [Name] +'!',12
from Countries
No need for loops, databases are optimized for SET based operations, take advantage of that