473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

multiple inserts

30
Hello,
I have two tables,
Clients: [Client ID] [Location].....
Followup: [Client ID] [Location] [Date] [Results]
I would like to mass update by inserting new records in followup based on [Location] in Clients. That is, if Location is = "Mumbai" insert a new record into Followup, containing each Client ID and Location in addition to a [Date] and [Results], the date and results will be the same for each. So my end result in Followup will be like the following

[ Client ID] [Location][Date][Results]
(01), (Mumbai), (2008-03-04), (Positive)
(07), (Mumbai), (2008-03-04), (Positive)
(11), (Mumbai), (2008-03-04), (Positive)
(15), (Mumbai), (2008-03-04), (Positive)
(22), (Mumbai), (2008-03-04), (Positive)
(22), (Mumbai), (2008-03-04), (Positive)
(24), (Mumbai), (2008-03-04), (Positive)
(27), (Mumbai), (2008-03-04), (Positive)
(31), (Mumbai), (2008-03-04), (Positive)
(38), (Mumbai), (2008-03-04), (Positive)
(50), (Mumbai), (2008-03-04), (Positive)


Any ideas?
Thanks
JAS
Mar 4 '08 #1
3 1242
amitpatel66
2,367 Expert 2GB
Hello,
I have two tables,
Clients: [Client ID] [Location].....
Followup: [Client ID] [Location] [Date] [Results]
I would like to mass update by inserting new records in followup based on [Location] in Clients. That is, if Location is = "Mumbai" insert a new record into Followup, containing each Client ID and Location in addition to a [Date] and [Results], the date and results will be the same for each. So my end result in Followup will be like the following

[ Client ID] [Location][Date][Results]
(01), (Mumbai), (2008-03-04), (Positive)
(07), (Mumbai), (2008-03-04), (Positive)
(11), (Mumbai), (2008-03-04), (Positive)
(15), (Mumbai), (2008-03-04), (Positive)
(22), (Mumbai), (2008-03-04), (Positive)
(22), (Mumbai), (2008-03-04), (Positive)
(24), (Mumbai), (2008-03-04), (Positive)
(27), (Mumbai), (2008-03-04), (Positive)
(31), (Mumbai), (2008-03-04), (Positive)
(38), (Mumbai), (2008-03-04), (Positive)
(50), (Mumbai), (2008-03-04), (Positive)


Any ideas?
Thanks
JAS
Are you looking at something like:

Expand|Select|Wrap|Line Numbers
  1.  
  2. INSERT INTO followup SELECT clientid,location,'2008-03-04','Positive' FROM client WHERE location = 'Mumbai'
  3.  
  4.  
Mar 4 '08 #2
jas2803
30
wow, so simple, but not very intuitive....worked like a charm.
I looked but all I could find was how to select and insert the selected column data only.
Thanks
Mar 4 '08 #3
amitpatel66
2,367 Expert 2GB
wow, so simple, but not very intuitive....worked like a charm.
I looked but all I could find was how to select and insert the selected column data only.
Thanks
You are Welcome Jas2803. Do post back in case of any further issues!!
Mar 5 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
2
by: Joe | last post by:
Hey, I'm going to give some background on my situation in case anyone can point out a way around my problem altogether... for the problem itself, please skip to the bottom of the post. thanks....
1
by: Primo | last post by:
Hello, I am building a data management application with the following processes: Process 1 is a Windows service which uses FileSystemWatcher to monitor a directory. Process 2 opens a file...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
5
by: Humble Geek | last post by:
Hi all. Quick and perhaps silly question, but... I am using Pg 7.3. I am writing a function using pgplsql. This function will perform multiple inserts. Let's say two of the inserts are as...
2
by: Diego | last post by:
Hi everybody! I'm using DB2 PE v8.2.3 for linux. I've defined a database with the following schema: ANNOTATION(ID,AUTHOR,TEXT) ANNOTATION_BOOK(ANNOTATION_ID,OBJECT_ID)...
0
by: dustwel | last post by:
I am currently trying to write a trigger that when an insert or update is made to a table, it inserts a copy of the row into a log table. It currently works when one row is inserted, but it will...
6
by: BostonNole | last post by:
I am using SQL 2000 and VB.NET (VS 2005). I have three stored procedure: sp_A, sp_B and sp_C I need to be able to call sp_A once and sp_B and sp_C 1 to n number of times all within a single...
2
gchq
by: gchq | last post by:
Hi there This was the closest to Sybase I could see.... If I wanted to perform a multiple insert based on values in a table using, say a web app, I'd define a DataTable and bring in the...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.