Jump to content

updating tables?


codrgii

Recommended Posts

i'm trying to update a column of a table by selecting two different values from 2 different tables, i'm doing -

 

UPDATE table_temp

    SET sum = table_temp.Point - table_RATING.Point

 

and when trying that it pops up an error saying

 

The multi-part identifier "table_RATING.Point" could not be bound.

 

does anyone know what i'm doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/193989-updating-tables/
Share on other sites

You could try

UPDATE table_temp
    SET sum = table_temp.Point - (SELECT Point FROM table_RATING)

 

...? I could be wrong but I think this is nowhere near correct syntax to produce any results.

I'm not sure if its possible to do this without having some kind of link between the two tables. In that case you would need to JOIN the tables together on some kind of key. Then you would be able to access each corresponding record. Of course I'm fairly new so this could be wrong too ^_^

Link to comment
https://forums.phpfreaks.com/topic/193989-updating-tables/#findComment-1020875
Share on other sites

Look into the JOIN keyword like I told you.

 

What kind of answer is that? have a read at what i asked in my post first on this topic...

 

 

does anyone know what i'm doing wrong?

 

this is what i asked, i'm fairly new to php myself so any examples would be a real help.

 

This is the answer I gave you and the post I was referring to when I said "like I told you"

 

You could try

UPDATE table_temp
    SET sum = table_temp.Point - (SELECT Point FROM table_RATING)

 

...? I could be wrong but I think this is nowhere near correct syntax to produce any results.

I'm not sure if its possible to do this without having some kind of link between the two tables. In that case you would need to JOIN the tables together on some kind of key. Then you would be able to access each corresponding record. Of course I'm fairly new so this could be wrong too ^_^

 

I think you need a RTFM. The JOIN keyword is used to group two tables together. You need some kind of key to group them buy. Without knowing the way that anything is set up on your database we cannot do the work for you. Have you typed JOIN MySql into google?

Link to comment
https://forums.phpfreaks.com/topic/193989-updating-tables/#findComment-1020915
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.