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

I need help with copy table to table with asp

Hello!

I been working on a problem for a while. I need to copy data from 2 tables and merge them in to 1 table that already exists. i need to extract a column called "bpo" and a column called "usr" from 2 different tables called anv and bpo and then copy them into a table called mybpo.

I guess it shood look something like this:

sql = "INSERT INTO mybpo SELECT usr FROM anv where usr ='" & usr & "' and SELECT bpo FROM bpo "

but i cant get it to work, tried allot of combinations, Please help me

/Regards Phiber
Feb 25 '09 #1
4 2661
jhardman
3,406 Expert 2GB
Phiber,

I'm not sure I understand you, let me see if I have this straight:
You have three tables in the same database, "bpo", "anv", and "mybpo". You need to take values from two of those tables (bpo and anv) to insert new records into the third table. Is this right? It sounds like a job for a custom view or a stored procedure rather than a whole table. Or do you just need to pull up a single query with info from all three tables? That is what "Join"s are for.

Jared
Feb 26 '09 #2
hi sorry for the late answer
Its a one time copy every time a user register as a "builder" on the site, then all the "build plans/schematics" will automatically copy in to the mybpo, with bpo + anv on the same id (table anv holds the user data), which ofc will increase the number on the "id" tag like :

usr1+bpo1 id=1
usr1+bpo2 id=2
usr1+bpo3 id=3
usr1+bpo4 id=4
usr1+bpo5 id=5
usr1+bpo6 id=6

usr value and bpo value are collected through 2 tables in the database, 1 reason, to make entry for new build plans easier and when the user register as builder all plans in the database gets available unique to usr.

I know i can do it the other way around and list the plans, and then let the user add just by clicking on them, but this is really time consuming and therefore not an option

thx for shown interest btw :D
Feb 27 '09 #3
jhardman
3,406 Expert 2GB
Make the insert one at a time, but you can definitely automate it with a loop. use a subquery that joins the two other tables and returns the two values you want.

Jared
Feb 27 '09 #4
ok great idea thx, will try to play around with that
Feb 28 '09 #5

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

Similar topics

7
by: Galina | last post by:
Hello I am going to copy a data from MS Access table into Oracle table. One of fields is memo type and data in this field range from 1 character to 551 long string. Do I need to create a field...
3
by: Dante | last post by:
Tonight I started writing a script that places a "Copy All" link before every PRE tag. The link would copy the code in the pre tag. I can't get this script to work. Can anyone help me? Here is my...
2
by: spammy | last post by:
hi all, im trying to establish whether i have a race condition or critical section in the following. i have a dataaccess class that continually retireves a table from a sqlserver (which may be...
4
by: Andromeda | last post by:
I have two tables... one contains all the loan officer information (name/address/phone/email/etc) the other is a NH license table which lists has 3 columns - txtLOName, dtDateHireSent,...
3
by: I Are Confused | last post by:
I am trying to open Database #2 while in Database #1 and delete a table that is in #2 so that I can copy a table from #1 into #2 - all through a function. My Database #2, as part of the start up,...
2
by: Mark | last post by:
Hello, We currently have a table (access 2000) that has the following values: 706 6789 1 5.11 N N 20040923 792 6592 1 10.05 N N 20040923 795 1605 1 6.30 N N 20040923 807 5817 1 6.33 N N...
0
by: EiEiO | last post by:
Hello all. I am hoping I could get some suggestions on moving forward. My Challenge: Importing data from one table to another where the field names almost never match. My Form has a list...
4
by: carra | last post by:
Hi If I have some XML that looks like this... <heading1>fdfdfdfdf</heading> <para>text1</para> <para>text2</para> <table>Table structure</table> <para>text3</para> <heading2>gfhgjg</heading>...
2
by: phiber102 | last post by:
Hello! I been working on a problem for a while. I need to copy data from 2 tables and merge them in to 1 table that already exists. i need to extract a column called "bpo" and a column called...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.