473,396 Members | 2,154 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,396 software developers and data experts.

How do I combine INSERT & SELECT statements?

135 100+
In the following mySQL code:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO comments 
  2. (relateditemtype,relateditemid,region_id, 
  3. user_id, comment_text,dateadded)            
  4. VALUES (?,?,?,?,?,NOW())
I want to 'add' another field (company) from another table (account table), how do I this?

Thank you

RP
Jul 24 '07 #1
1 1606
r035198x
13,262 8TB
In the following mySQL code:

INSERT INTO comments
(relateditemtype,relateditemid,region_id,
user_id, comment_text,dateadded)
VALUES (?,?,?,?,?,NOW())

I want to 'add' another field (company) from another table (account table), how do I this?

Thank you

RP
I don't get your problem completely. Perhaps if you can clarify the following?
Do you have a column called company on the comments table?
If you do, what's your rule for setting a compay in that table? i.e How do you determine which company is set for which row in the comments table.
Jul 24 '07 #2

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

Similar topics

0
by: Frank Collins | last post by:
Can anyone point me to some good examples on the web of using values from dynamically created checkboxes on forms in ASP, particularly relating to INSERTING those values into a SQL or Access...
1
by: Shock | last post by:
Hi everybody, I just wrote my first two triggers and from the minimal amount of testing I have done, they work! However, I was hoping I could get some feedback from those of you more...
1
by: avital | last post by:
Hi, I have 2 queries that I need to join. I have the following tables: attendancelog : headerid reportmonth attlogstuds: headerid sid
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
1
by: rdraider | last post by:
Hi all, We have an app that uses SQL 2000. I am trying to track when a code field (selcode) is changed on an order which then causes a status field (status) to change. I tried a trigger but...
3
by: Dmitri | last post by:
Hello! I have a developer that is playing around with some SQL statements using VB.NET. He has a test table in a SQL 2000 database, and he has about 2000 generated INSERT statements. When the...
20
by: Steve London | last post by:
I'm sure this has been brought up many times, but I will ask anyway. Let's say I have 2 tables related: Owner: --------- o_id o_name Dog:
2
by: leedo | last post by:
Hi, I am almost going crazy with this. I have a table that I bulk insert into from another database using VS2005. I need to change the data in the records before committing the values in the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.