Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 30th, 2006, 10:40 AM
Registered User
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Complicated Insert Statement

I have a table called USERS that has a column called Division. The values are actually the Division_id from another table called DIVISIONS. I need to create a column in the USERS table that lists the Division_name, which can also be found in the DIVISION table.

Each Division_name has a Division_id, so the new column's data (Division_name) must equal the Division_id that is already in the USER table.

I'm not sure if this can be done, but I think it needs to be something like this....

INSERT INTO users (sbu)
From Division d, Users u
WHERE u.division_id = d.division_name

I'm really new at SQL so I need some assistnace.


Old May 31st, 2006, 09:08 AM
Authorized User
Join Date: May 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts

One thing I can see is you need to use an update statement. If there are already rows, then you want to update them.

Similar Threads
Thread Thread Starter Forum Replies Last Post
complicated if else statement help needed cmt9000 Classic ASP Basics 1 December 13th, 2006 06:34 PM
Insert Statement Iashia06 Access 0 April 7th, 2006 12:45 PM
Insert into statement not working. alisonchase Access ASP 8 January 16th, 2005 10:52 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.