•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 401,561 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,472 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 1157 | Replies: 0
![]() |
•
•
Join Date: Jul 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hello. I'll get to the point. I need to add new rows to table2 depending on the data found in table1. I've tried a small query I wrote up myself but I doubt it will work and can't risk screwing this database up. Note: These tables are extremely long, one of them has over 300,000 records but only about 50 lines need to be added.
Here is the structure:
Table: user_data
Selected Columns: user_id, round_number, item_a, item_b, item_c
Table: user_item
Selected Columns: item_id(auto numbered), user_id, item_type, amount
Both tables have 'user_id' in common.
I need to get the values from 'item_a', 'item_b', and 'item_c'
FROM user_data
WHERE round_number = 89
and INSERT INTO user_item the sum of (item_a * 3 + item_b * 5 + item_c * 10)
The sum of these 3 operations should be inserted into user_item.amount
user_item.item_type should always be set to '5575'
(Also, a nice site of tutorials for MSSQL where I could learn would be nice as well)
Thank you
Here is the structure:
Table: user_data
Selected Columns: user_id, round_number, item_a, item_b, item_c
Table: user_item
Selected Columns: item_id(auto numbered), user_id, item_type, amount
Both tables have 'user_id' in common.
I need to get the values from 'item_a', 'item_b', and 'item_c'
FROM user_data
WHERE round_number = 89
and INSERT INTO user_item the sum of (item_a * 3 + item_b * 5 + item_c * 10)
The sum of these 3 operations should be inserted into user_item.amount
user_item.item_type should always be set to '5575'
(Also, a nice site of tutorials for MSSQL where I could learn would be nice as well)
Thank you
Last edited by goodtimeshaxor : Jul 29th, 2007 at 1:27 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access ajax asp breach broadband code combo crime daniweb data data protection data transfer database developer development drive dropdownlist forensics government gpt guid partition table hacker hard hardware hitachi internet linux microsoft module msdn net news office partition reuse security software sql storage survey terabyte vista web wikipedia
- How to save data from a variable to a table. (PHP)
- insert data from one form into two diffent database table (JSP)
- insert and update data in two different database (JSP)
- Access table data transfer to file (MS SQL)
- Populate Listboxes with table data (VB.NET)
Other Threads in the MS SQL Forum
- Previous Thread: RPC server unavailable on installer connecting to MSSQL instance
- Next Thread: quick question


Linear Mode