Forum Moderators: open
after reading multiple site on updating one column from another i created this.
UPDATE available, tarriff
SET available.date = tarriff.date
WHERE available.TarriffID = tarriff.ID
BUT i get this whatever i change.
MySQL said:
You have an error in your SQL syntax near '
tarriff SET available.date = tarriff.date WHERE available.TarriffID = tarriff.I' at line 1
i am really stuck not knowing much about mysql
TIA
Smad
SQL-query :
UPDATE available SET available.date = tarriff.date WHERE available.TarriffID = tarriff.ID
MySQL said:
Unknown table 'tarriff' in where clause
server is running MySQL 3.23.56
"Before MySQL 4.0.18, you need the UPDATE privilege for all tables used in a multiple-table UPDATE, even if they were not updated. As of MySQL 4.0.18, you need only the SELECT privilege for any columns that are read but not modified."
is this the problem although i am logged directly to the DB
Smad
Try something like the following:
UPDATE available
SET available = ( SELECT tarriff.date
FROM tarriff
WHERE available.TarriffID = tarriff.ID)
WHERE EXISTS
( SELECT tarriff.TarriffID
FROM tarriff
WHERE available.TarriffID = tarriff.ID);
SQL-query :
UPDATE available SET available = ( SELECT tarriff.date
FROM tarriff
WHERE available.TarriffID = tarriff.ID )
WHERE EXISTS (
SELECT tarriff.TarriffID
FROM tarriff
WHERE available.TarriffID = tarriff.ID
)
MySQL said:
You have an error in your SQL syntax near 'SELECT tarriff.date
FROM tarriff
WHERE available.TarriffID = tarriff.ID )
WHERE' at line 1
server is running MySQL 3.23.56
Starting with MySQL 4.0.4, you can also perform UPDATE operations covering multiple tablesResource:
[dev.mysql.com...]
You won't be able to do what you want here until you update that MySQL server.
Starting with MySQL 4.0.4, you can also perform UPDATE operations covering multiple tables.
... and then, on the very same page ...
Before MySQL 4.0.18, you need the UPDATE privilege for all tables used in a multiple-table UPDATE ...
... which is misleading as it leads us to believe that we have the ability to UPDATE multiple tables as of 4.0.18, which is not the case. Here is where we find out for sure, in the changelogs ...
B.2.30. Changes in release 4.0.2 (01 July 2002)First pre-version of multiple-table UPDATE statement.
Resource:
[dev.mysql.com...]
Either way, you are still running a 3.x version and as you now know, multiple-table updates just were not available at that time. You'll have to program a workaround :(
the decision to upgrade is with the hosting company not myself
Figured that was the case, therefore leaving you no choice but a programmatic workaround, ... if you remain on the same host. I should have mentioned the alternative option -- to switch hosting companies, letting the current company know why you are doing so. Running technology that is that many years old shows you one thing about the hosting provider you have chosen.
I agree with syber, personally I would upgrade. Even if it means switching hosts.