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

transfer the columns of one table into another table with condition

hi all,

In table1, i have 6 columns and in table2, i have 10 columns.
i want to transfer 5 columns from table2 to table1 with the condition.

the condition is..

both the tables have primarykey, if the primary key in table1 matches with table2's primarykey, then we should trafer the selected column in to table1 from table2.

I want a query for the above..

Please help me in this...

Thanks in advance.
Jan 19 '07 #1
2 3239
ronverdonk
4,258 Expert 4TB
From the depth and scope of your questions I have the distinct feeling that you do not know very much about SQL. Maybe it is a good idea to get some education and follow a few starter's tutorials. For now I will help you out, but the next time you show some of your code here with which we will, of course, help you. But the idea of this forum is to have programmers help programmers, not by supplying code but by providing assistance.
Expand|Select|Wrap|Line Numbers
  1. UPDATE table2 as t2, table1 as t1 
  2.   SET 
  3.     t2.col1=t1.col1, 
  4.     t2.col2=t1.col2,
  5.     t2.col3=t1.col3,
  6.     t2.col4=t1.col4,
  7.     t2.col5=t1.col5,
  8.   WHERE t2.keycol = t1.keycol
Ronald :cool:
Jan 19 '07 #2
Hi thanks for the query...

I already mentioned that i am newly started to program...
I have already started to study PHP-MySQL.
I tried that but I couldn't.
Next time defenitly, i will come with my code...
thanks...
Jan 20 '07 #3

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

Similar topics

8
by: Catherine Jo Morgan | last post by:
Some columns in the excel contact info spreadsheet correspond exactly with the new database fields. Three columns contain a mishmash of info that will need to be entered manually in the correct...
4
by: lorirobn | last post by:
Hello, I'd be curious to hear other thoughts on my database and table design. My database is for 'space use' in a lodging facility - will hold all spaces, like rooms (lodging rooms, dining...
3
by: Dancefire | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, What i am tring to do is to transfer a database tabe SRC to another database DEST. Actually it's not only simple transfer, but the row in...
5
by: Ron St-Pierre | last post by:
I found this error in /var/log/messages yesterday after a cron job wouldn't complete: STATEMENT: ALTER TABLE victoria.eodData DROP COLUMN tickDate; ERROR: tables can have at most 1600 columns...
1
by: Daniel | last post by:
HI all, Does anyone know how to transfer the filtered dataview to another new dataview? for example, in dvA has 3 rows. After filter by condition, it has 2 rows being displayed. The dvB set...
6
by: Don | last post by:
I'm thinking this is simple and I'm just not understanding how to do it but I have to ask because I'm stumped. I have a query (which is used to create a report) and three of the columns in this...
1
by: mshenoud | last post by:
I have a comboBox with two columns. I would like to isolate each column so as to compare it to an entry in a table so as to be able to load a yet another form. how can I do that? Details: The...
2
by: pratsadhu | last post by:
Hi, I have a table which has columns name, date1, date2. Through 'Or' condition, i can update name but to update date1 and date2 I have another condition. ID1 matches, date1 will be updated...
3
by: smrkeyan316 | last post by:
How do i transfer rows into columns using query? Please help me to solve this situation I have a table that stores records like Table “x” ID WeekEnd % 1 10/12/07 70 1 10/13/07 80
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...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.