SQL SQL SQL SQL

hi,
i have 2 problems here.

1)
i have 2 tables:

    currency                              rates
+---------------------+          +--------------------+
| code char(3)        |          | currency char(3)   |
| name varchar(10)    |          | rate double        |
| bcurrency char(1 )  |          | ryear varchar(4)   |
|                     |          | rmonth varchar(10) |
+---------------------+          +--------------------+

I'm have a form, from which i pick 2 value "2000" and "february".
I'm trying to insert fields form currency to rates, matching
particular conditions in order to avoid data duplication.
The rate table basically has the exchange rate for a particular
currency in a particular year and a particular month.
The trio currency,ryear,rmonth SHOULD be unique.

My query is the following:

insert into rates (currency,ryear,rmonth)
select a.code, "2000", "february"  from currency a, rates b
where a.bcurrency="N" and a.code<>b.currency and
b.ryear="2000" and b.rmonth="february"


The error message i get is: "INSERT TABLE 'rates' isn't allowed
in FROM table list".
How can i solve this problem??

PS:This query works well when i don't add the condition after the first
condition in the where clause.


2)
i have a "read only table!" error message when i try to execute a "insert
into ...select"
from a program.
How can i check this status of the table??
Is there a command to tell me which table is read only at a particular time?




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to